custom/plugins/DvsnReturnShipment/src/DvsnReturnShipment.php line 25

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * digitvision
  4.  *
  5.  * @category  digitvision
  6.  * @package   Shopware\Plugins\DvsnReturnShipment
  7.  * @copyright (c) 2020 digitvision
  8.  *
  9.  * @todo html email for the shop owner
  10.  * @todo list of returns in order details in admin
  11.  * @todo individual links for each country instead of label
  12.  */
  13. namespace Dvsn\ReturnShipment;
  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 DvsnReturnShipment extends Plugin
  22. {
  23.     /**
  24.      * {@inheritDoc}
  25.      */
  26.     public function build(ContainerBuilder $container): void
  27.     {
  28.         // set plugin parameters
  29.         $container->setParameter('dvsn.return_shipment.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.         );
  65.         $installer->install();
  66.     }
  67.     /**
  68.      * {@inheritDoc}
  69.      */
  70.     public function postInstall(InstallContext $installContext): void
  71.     {
  72.     }
  73.     /**
  74.      * {@inheritDoc}
  75.      */
  76.     public function update(UpdateContext $updateContext): void
  77.     {
  78.         // call updater
  79.         $installer = new Setup\Update(
  80.             $this,
  81.             $updateContext,
  82.             $this->container->get(Connection::class),
  83.             $this->container->get('custom_field_set.repository'),
  84.             $this->container->get('custom_field.repository')
  85.         );
  86.         $installer->update($updateContext->getCurrentPluginVersion());
  87.     }
  88.     /**
  89.      * {@inheritDoc}
  90.      */
  91.     public function postUpdate(UpdateContext $updateContext): void
  92.     {
  93.     }
  94.     /**
  95.      * {@inheritDoc}
  96.      */
  97.     public function uninstall(UninstallContext $context): void
  98.     {
  99.         // call uninstaller
  100.         $installer = new Setup\Uninstall(
  101.             $this,
  102.             $context,
  103.             $this->container->get(Connection::class),
  104.             $this->container->get('custom_field_set.repository'),
  105.             $this->container->get('custom_field.repository')
  106.         );
  107.         $installer->uninstall();
  108.     }
  109. }