<?php declare(strict_types=1);
namespace CustomFieldAdd;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use CustomFieldAdd\Installer\CustomFieldInstaller;
class CustomFieldAdd extends Plugin
{
public function install(InstallContext $context): void
{
// $this->getCustomFieldInstaller()->install($context);
}
public function uninstall(UninstallContext $uninstallContext): void
{
parent::uninstall($uninstallContext);
if ($uninstallContext->keepUserData()) {
return;
}
$this->getCustomFieldInstaller()->uninstall($uninstallContext);
}
private function getCustomFieldInstaller(): CustomFieldInstaller
{
/** @var EntityRepository $customFieldSetRepository */
$customFieldSetRepository = $this->container->get('custom_field_set.repository');
/** @var EntityRepository $customFieldRepository */
$customFieldRepository = $this->container->get('custom_field.repository');
return new CustomFieldInstaller($customFieldSetRepository, $customFieldRepository);
}
}