<?php declare(strict_types=1);
namespace TopdataRegistrationForm;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
class TopdataRegistrationForm extends Plugin
{
/**
* @throws \Exception
*/
public function postInstall(InstallContext $installContext): void
{
parent::postInstall($installContext);
$this->installAssets();
}
/**
* @throws \Exception
*/
public function postUpdate(UpdateContext $updateContext): void
{
parent::postUpdate($updateContext);
$this->installAssets();
}
/**
* @throws \Exception
*/
private function installAssets(): void
{
$kernel = $this->container->get('kernel');
$application = new Application($kernel);
$application->setAutoExit(false);
$input = new ArrayInput(['command' => 'assets:install']);
$output = new BufferedOutput();
$application->run($input, $output);
}
}