vendor/store.shopware.com/swpaloginascustomer/src/SwpaLoginAsCustomer.php line 26

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Swpa\SwpaLoginAsCustomer;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  6. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  7. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  8. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  9. use Shopware\Core\System\SystemConfig\SystemConfigService;
  10. use Swpa\SwpaLoginAsCustomer\Setup;
  11. use Symfony\Component\Config\FileLocator;
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  14. //require_once __DIR__ . '/../vendor/autoload.php';
  15. /**
  16.  * Main class of the plugin SwpaLoginAsCustomer:
  17.  *
  18.  * @package Swpa\SwpaLoginAsCustomer
  19.  * @license See COPYING.txt for license details
  20.  * @author  swpa <info@swpa.dev>
  21.  */
  22. class SwpaLoginAsCustomer extends Plugin
  23. {
  24.     /**
  25.      * @param ContainerBuilder $container
  26.      *
  27.      * @throws \Exception
  28.      */
  29.     public function build(ContainerBuilder $container): void
  30.     {
  31.         $yamlLoader = new YamlFileLoader($container, new FileLocator(__DIR__ '/DI/config'));
  32.         $yamlLoader->load('controllers.yml');
  33.         $yamlLoader->load('entities.yml');
  34.         parent::build($container);
  35.     }
  36.     /**
  37.      * @return string
  38.      */
  39.     public function getStorefrontScriptPath(): string
  40.     {
  41.         return 'Resources/dist/storefront/js';
  42.     }
  43.     public function getViewPaths(): array
  44.     {
  45.         $viewPaths parent::getViewPaths();
  46.         $viewPaths[] = 'Resources/views/storefront';
  47.         return $viewPaths;
  48.     }
  49.     /**
  50.      * @param InstallContext $context
  51.      */
  52.     public function install(InstallContext $context): void
  53.     {
  54.         $install = new Setup\Install(
  55.             $this->container->get(Connection::class),
  56.             $this->container->get(SystemConfigService::class)
  57.         );
  58.         $install->install($context);
  59.         parent::install($context);
  60.     }
  61.     /**
  62.      * @param UninstallContext $context
  63.      */
  64.     public function uninstall(UninstallContext $context): void
  65.     {
  66.         /** @var Setup\Uninstall $install */
  67.         $install = new Setup\Uninstall($this->container->get(Connection::class));
  68.         $install->uninstall($context);
  69.         parent::uninstall($context);
  70.     }
  71.     /**
  72.      * @param ActivateContext $context
  73.      */
  74.     public function activate(ActivateContext $context): void
  75.     {
  76.         /** @var Setup\Activate $install */
  77.         $install = new Setup\Activate$this->container->get(Connection::class) );
  78.         $install->activate($context);
  79.         parent::activate($context);
  80.     }
  81.     /**
  82.      * @param DeactivateContext $context
  83.      */
  84.     public function deactivate(DeactivateContext $context): void
  85.     {
  86.         /** @var Setup\Deactivate $install */
  87.         $install = new Setup\Deactivate($this->container->get(Connection::class));
  88.         $install->deactivate($context);
  89.         parent::deactivate($context);
  90.     }
  91. }