vendor/store.shopware.com/dvsnticketsystem/src/DvsnTicketSystem.php line 25

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