custom/plugins/DvsnPseudoProduct/src/DvsnPseudoProduct.php line 23

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * digitvision
  4.  *
  5.  * @category  digitvision
  6.  * @package   Shopware\Plugins\DvsnPseudoProduct
  7.  * @copyright (c) 2020 digitvision
  8.  *
  9.  * @todo price struct instead of number input
  10.  */
  11. namespace Dvsn\PseudoProduct;
  12. use Doctrine\DBAL\Connection;
  13. use Shopware\Core\Framework\Plugin;
  14. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  15. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  16. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  17. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  18. use Symfony\Component\DependencyInjection\ContainerBuilder;
  19. class DvsnPseudoProduct extends Plugin
  20. {
  21.     /**
  22.      * {@inheritDoc}
  23.      */
  24.     public function build(ContainerBuilder $container): void
  25.     {
  26.         // set plugin parameters
  27.         $container->setParameter('dvsn.pseudo_product.path'$this->getPath());
  28.         // call parent
  29.         parent::build($container);
  30.     }
  31.     /**
  32.      * {@inheritDoc}
  33.      */
  34.     public function activate(ActivateContext $activateContext): void
  35.     {
  36.     }
  37.     /**
  38.      * {@inheritDoc}
  39.      */
  40.     public function install(InstallContext $installContext): void
  41.     {
  42.         // call installer
  43.         $installer = new Setup\Install(
  44.             $this,
  45.             $installContext,
  46.             $this->container->get(Connection::class),
  47.             $this->container->get('custom_field_set.repository'),
  48.             $this->container->get('custom_field.repository'),
  49.             $this->container->get('number_range.repository'),
  50.             $this->container->get('mail_template.repository'),
  51.             $this->container->get('document_type.repository'),
  52.             $this->container->get('document_base_config.repository')
  53.         );
  54.         $installer->install();
  55.         // call updater
  56.         $installer = new Setup\Update(
  57.             $this,
  58.             $installContext,
  59.             $this->container->get(Connection::class),
  60.             $this->container->get('custom_field_set.repository'),
  61.             $this->container->get('custom_field.repository')
  62.         );
  63.         $installer->install();
  64.     }
  65.     /**
  66.      * {@inheritDoc}
  67.      */
  68.     public function postInstall(InstallContext $installContext): void
  69.     {
  70.     }
  71.     /**
  72.      * {@inheritDoc}
  73.      */
  74.     public function update(UpdateContext $updateContext): void
  75.     {
  76.         // call updater
  77.         $installer = new Setup\Update(
  78.             $this,
  79.             $updateContext,
  80.             $this->container->get(Connection::class),
  81.             $this->container->get('custom_field_set.repository'),
  82.             $this->container->get('custom_field.repository')
  83.         );
  84.         $installer->update($updateContext->getCurrentPluginVersion());
  85.     }
  86.     /**
  87.      * {@inheritDoc}
  88.      */
  89.     public function postUpdate(UpdateContext $updateContext): void
  90.     {
  91.     }
  92.     /**
  93.      * {@inheritDoc}
  94.      */
  95.     public function uninstall(UninstallContext $context): void
  96.     {
  97.         // call uninstaller
  98.         $installer = new Setup\Uninstall(
  99.             $this,
  100.             $context,
  101.             $this->container->get(Connection::class),
  102.             $this->container->get('custom_field_set.repository'),
  103.             $this->container->get('custom_field.repository')
  104.         );
  105.         $installer->uninstall();
  106.     }
  107. }