custom/plugins/topdataregistrationform/src/TopdataRegistrationForm.php line 12

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace TopdataRegistrationForm;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  5. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  6. use Symfony\Bundle\FrameworkBundle\Console\Application;
  7. use Symfony\Component\Console\Input\ArrayInput;
  8. use Symfony\Component\Console\Output\BufferedOutput;
  9. class TopdataRegistrationForm extends Plugin
  10. {
  11.     /**
  12.      * @throws \Exception
  13.      */
  14.     public function postInstall(InstallContext $installContext): void
  15.     {
  16.         parent::postInstall($installContext);
  17.         $this->installAssets();
  18.     }
  19.     /**
  20.      * @throws \Exception
  21.      */
  22.     public function postUpdate(UpdateContext $updateContext): void
  23.     {
  24.         parent::postUpdate($updateContext);
  25.         $this->installAssets();
  26.     }
  27.     /**
  28.      * @throws \Exception
  29.      */
  30.     private function installAssets(): void
  31.     {
  32.         $kernel $this->container->get('kernel');
  33.         $application = new Application($kernel);
  34.         $application->setAutoExit(false);
  35.         $input = new ArrayInput(['command' => 'assets:install']);
  36.         $output = new BufferedOutput();
  37.         $application->run($input$output);
  38.     }
  39. }