<?php
/**
* gb media
* All Rights Reserved.
*
* Unauthorized copying of this file, via any medium is strictly prohibited.
* The content of this file is proprietary and confidential.
*
* @category Shopware
* @package Shopware_Plugins
* @subpackage GbmedLabellingTyres
* @copyright Copyright (c) 2021, gb media
* @license proprietary
* @author Giuseppe Bottino
* @link http://www.gb-media.biz
*/
declare(strict_types=1);
namespace Gbmed\LabellingTyres;
use Doctrine\DBAL\DBALException;
use Gbmed\LabellingTyres\Installer\Installer;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Doctrine\DBAL\Connection;
use Shopware\Core\System\SystemConfig\SystemConfigService;
class GbmedLabellingTyres extends Plugin
{
/** @var Installer */
private $installer;
/**
* install the plugin data
*
* @param InstallContext $context
* @throws DBALException
*/
public function install(InstallContext $context): void
{
$this->getInstaller()->install($context);
parent::install($context);
}
/**
* removing the plugin data
*
* @param UninstallContext $context
*
* @throws \Doctrine\DBAL\DBALException
*/
public function uninstall(UninstallContext $context): void
{
$this->getInstaller()->uninstall($context);
parent::uninstall($context);
}
/**
* return Installer instance
*
* @return Installer
*/
private function getInstaller(): Installer
{
if (!$this->installer) {
$this->installer = new Installer(
$this->container->get('custom_field_set.repository'),
$this->container->get('language.repository'),
$this->container->get(SystemConfigService::class),
$this->container->get(Connection::class)
);
}
return $this->installer;
}
}