diff --git a/src/CoreShop/Bundle/IndexBundle/CoreShopIndexBundle.php b/src/CoreShop/Bundle/IndexBundle/CoreShopIndexBundle.php index 14ef9979e2..1eaf32f114 100644 --- a/src/CoreShop/Bundle/IndexBundle/CoreShopIndexBundle.php +++ b/src/CoreShop/Bundle/IndexBundle/CoreShopIndexBundle.php @@ -20,12 +20,25 @@ use CoreShop\Bundle\IndexBundle\DependencyInjection\Compiler\RegisterIndexWorkerPass; use CoreShop\Bundle\IndexBundle\DependencyInjection\Compiler\RegisterInterpreterPass; use CoreShop\Bundle\IndexBundle\DependencyInjection\Compiler\RegisterOrderRendererTypesPass; +use CoreShop\Bundle\MenuBundle\CoreShopMenuBundle; use CoreShop\Bundle\ResourceBundle\AbstractResourceBundle; use CoreShop\Bundle\ResourceBundle\CoreShopResourceBundle; +use Pimcore\Extension\Bundle\PimcoreBundleInterface; +use Pimcore\Extension\Bundle\Traits\PackageVersionTrait; +use Pimcore\HttpKernel\BundleCollection\BundleCollection; use Symfony\Component\DependencyInjection\ContainerBuilder; -final class CoreShopIndexBundle extends AbstractResourceBundle +final class CoreShopIndexBundle extends AbstractResourceBundle implements PimcoreBundleInterface { + use PackageVersionTrait; + + public static function registerDependentBundles(BundleCollection $collection) + { + parent::registerDependentBundles($collection); + + $collection->addBundle(new CoreShopMenuBundle(), 4000); + } + /** * {@inheritdoc} */ @@ -60,4 +73,80 @@ protected function getModelNamespace() { return 'CoreShop\Component\Index\Model'; } + + /** + * {@inheritdoc} + */ + public function getNiceName() + { + return 'CoreShop - Core'; + } + + /** + * {@inheritdoc} + */ + public function getDescription() + { + return 'CoreShop - Pimcore eCommerce'; + } + + /** + * {@inheritdoc} + */ + protected function getComposerPackageName(): string + { + return 'coreshop/index-bundle'; + } + + /** + * {@inheritdoc} + */ + public function getInstaller() + { + if ($this->container->has(Installer::class)) { + return $this->container->get(Installer::class); + } + + return null; + } + + /** + * {@inheritdoc} + */ + public function getAdminIframePath() + { + return null; + } + + /** + * {@inheritdoc} + */ + public function getJsPaths() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function getCssPaths() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function getEditmodeJsPaths() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function getEditmodeCssPaths() + { + return []; + } } diff --git a/src/CoreShop/Bundle/IndexBundle/DependencyInjection/CoreShopIndexExtension.php b/src/CoreShop/Bundle/IndexBundle/DependencyInjection/CoreShopIndexExtension.php index 1933ce7ae4..99ce77a440 100644 --- a/src/CoreShop/Bundle/IndexBundle/DependencyInjection/CoreShopIndexExtension.php +++ b/src/CoreShop/Bundle/IndexBundle/DependencyInjection/CoreShopIndexExtension.php @@ -41,6 +41,7 @@ public function load(array $config, ContainerBuilder $container) if (!array_key_exists('CoreShopCoreBundle', $bundles)) { $loader->load('services/menu.yml'); + $loader->load('services/installer.yml'); $config['pimcore_admin']['js']['menu'] = '/admin/coreshop/coreshop.index/menu.js'; } diff --git a/src/CoreShop/Bundle/IndexBundle/Installer.php b/src/CoreShop/Bundle/IndexBundle/Installer.php new file mode 100644 index 0000000000..6d1c358198 --- /dev/null +++ b/src/CoreShop/Bundle/IndexBundle/Installer.php @@ -0,0 +1,56 @@ +setAutoExit(false); + $options = ['command' => 'coreshop:resources:install']; + $options = array_merge($options, ['--no-interaction' => true, '--application-name object_index']); + $application->run(new ArrayInput($options)); + + $options = ['command' => 'coreshop:resources:create-tables']; + $options = array_merge($options, ['application-name' => 'coreshop', '--no-interaction' => true, '--force' => true]); + $application->run(new ArrayInput($options)); + } + + + /** + * {@inheritdoc} + */ + public function migrateInstall(Schema $schema, Version $version) + { + + } + + /** + * {@inheritdoc} + */ + public function migrateUninstall(Schema $schema, Version $version) + { + + } +} diff --git a/src/CoreShop/Bundle/IndexBundle/Menu/IndexMenuBuilder.php b/src/CoreShop/Bundle/IndexBundle/Menu/IndexMenuBuilder.php index 789270591b..5de8b04d06 100644 --- a/src/CoreShop/Bundle/IndexBundle/Menu/IndexMenuBuilder.php +++ b/src/CoreShop/Bundle/IndexBundle/Menu/IndexMenuBuilder.php @@ -84,7 +84,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st ->addChild('coreshop_indexes') ->setLabel('coreshop_indexes') ->setAttribute('permission', 'coreshop_permission_index') - ->setAttribute('iconCls', 'coreshop_icon_carriers') + ->setAttribute('iconCls', 'coreshop_icon_indexes') ->setAttribute('resource', 'coreshop.index') ->setAttribute('function', 'index'); diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/config/services/installer.yml b/src/CoreShop/Bundle/IndexBundle/Resources/config/services/installer.yml new file mode 100644 index 0000000000..42d067d1b5 --- /dev/null +++ b/src/CoreShop/Bundle/IndexBundle/Resources/config/services/installer.yml @@ -0,0 +1,10 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + CoreShop\Bundle\IndexBundle\Installer: + public: true + arguments: + $bundle: "@=service('kernel').getBundle('CoreShopIndexBundle')" diff --git a/src/CoreShop/Bundle/IndexBundle/composer.json b/src/CoreShop/Bundle/IndexBundle/composer.json index 297ebe9ee6..a628838018 100644 --- a/src/CoreShop/Bundle/IndexBundle/composer.json +++ b/src/CoreShop/Bundle/IndexBundle/composer.json @@ -21,6 +21,7 @@ "coreshop/index": "^2.0", "coreshop/registry": "^2.0", "coreshop/resource-bundle": "^2.0", + "coreshop/menu-bundle": "^2.1", "pimcore/pimcore": "^5.7.2" }, "conflict": { @@ -42,6 +43,11 @@ "extra": { "branch-alias": { "dev-master": "2.1-dev" + }, + "pimcore": { + "bundles": [ + "CoreShop\\Bundle\\IndexBundle\\CoreShopIndexBundle" + ] } } }