custom/plugins/zenitPlatformSphere/src/zenitPlatformSphere.php line 19

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace zenit\PlatformSphere;
  3. use Shopware\Core\Framework\Context;
  4. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
  5. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  6. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  7. use Shopware\Storefront\Framework\ThemeInterface;
  8. use Shopware\Core\Framework\Plugin;
  9. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  10. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  11. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  12. use Symfony\Component\Config\FileLocator;
  13. use Symfony\Component\DependencyInjection\ContainerBuilder;
  14. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  15. use zenit\PlatformSphere\Core\CustomFieldsHelper;
  16. class zenitPlatformSphere extends Plugin implements ThemeInterface
  17. {
  18.     /**
  19.      * @var Context
  20.      */
  21.     private $context;
  22.     public function getThemeConfigPath(): string
  23.     {
  24.         return 'theme.json';
  25.     }
  26.     public function install(InstallContext $installContext): void
  27.     {
  28.         parent::install($installContext);
  29.         $customFieldSetRepository $this->container->get('custom_field_set.repository');
  30.         $customFields = new CustomFieldsHelper($customFieldSetRepository);
  31.         $customFields->getCustomFields($this->container$installContext->getContext());
  32.     }
  33.     public function update(UpdateContext $updateContext): void
  34.     {
  35.         parent::update($updateContext);
  36.         if (version_compare($updateContext->getCurrentPluginVersion(), '2.6.0''<')) {
  37.             $customFieldSetRepository $this->container->get('custom_field_set.repository');
  38.             $customFields = new CustomFieldsHelper($customFieldSetRepository);
  39.             $customFields->getCustomFields($this->container$updateContext->getContext());
  40.         }
  41.     }
  42.     public function uninstall(UninstallContext $uninstallContext): void
  43.     {
  44.         parent::uninstall($uninstallContext);
  45.         if ($uninstallContext->keepUserData()) {
  46.             return;
  47.         }
  48.         $customFieldSetRepository $this->container->get('custom_field_set.repository');
  49.         $customFields = new CustomFieldsHelper($customFieldSetRepository);
  50.         $customFields->deleteCustomFields($uninstallContext->getContext());
  51.     }
  52.     /**
  53.      * @param ContainerBuilder $container
  54.      * @throws \Exception
  55.      */
  56.     public function build(ContainerBuilder $container): void
  57.     {
  58.         parent::build($container);
  59.         $loader = new XmlFileLoader($container, new FileLocator($this->getPath() . '/Core/Content/DependencyInjection'));
  60.         $loader->load('services.xml');
  61.     }
  62. }