From 32a9d949f3a1f08dc643cd8c286eb75460bca44b Mon Sep 17 00:00:00 2001 From: doishub Date: Wed, 8 Mar 2023 14:20:32 +0100 Subject: [PATCH 1/3] Remove unused Contao Framework from the Commandos and Migrations --- src/Command/ObjectConversionCommand.php | 8 +------- .../Version30/ObjectConversionMigration.php | 12 +----------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/Command/ObjectConversionCommand.php b/src/Command/ObjectConversionCommand.php index 18f855a..de02a3a 100644 --- a/src/Command/ObjectConversionCommand.php +++ b/src/Command/ObjectConversionCommand.php @@ -10,7 +10,6 @@ namespace Oveleon\ContaoComponentStyleManager\Command; -use Contao\CoreBundle\Framework\ContaoFramework; use Oveleon\ContaoComponentStyleManager\StyleManager\Sync; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\InvalidArgumentException; @@ -28,15 +27,10 @@ class ObjectConversionCommand extends Command { protected static $defaultName = 'contao:stylemanager:object-conversion'; - - protected ContaoFramework $framework; private Sync $sync; - public function __construct(ContaoFramework $contaoFramework, Sync $sync) + public function __construct(Sync $sync) { - $this->framework = $contaoFramework; - $this->framework->initialize(); - $this->sync = $sync; parent::__construct(); diff --git a/src/Migration/Version30/ObjectConversionMigration.php b/src/Migration/Version30/ObjectConversionMigration.php index 29f0785..bfbe220 100644 --- a/src/Migration/Version30/ObjectConversionMigration.php +++ b/src/Migration/Version30/ObjectConversionMigration.php @@ -2,7 +2,6 @@ namespace Oveleon\ContaoComponentStyleManager\Migration\Version30; -use Contao\CoreBundle\Framework\ContaoFramework; use Contao\CoreBundle\Migration\AbstractMigration; use Contao\CoreBundle\Migration\MigrationResult; use Doctrine\DBAL\Connection; @@ -15,23 +14,14 @@ class ObjectConversionMigration extends AbstractMigration */ private $connection; - /** - * @var ContaoFramework - */ - private $framework; - /** * @var Sync */ private $sync; - public function __construct(Connection $connection, ContaoFramework $framework, Sync $sync) + public function __construct(Connection $connection, Sync $sync) { $this->connection = $connection; - - $this->framework = $framework; - $this->framework->initialize(); - $this->sync = $sync; } From d5118355d6f824c2b7b12dc0ce0c01df1751c3eb Mon Sep 17 00:00:00 2001 From: doishub Date: Wed, 8 Mar 2023 14:29:05 +0100 Subject: [PATCH 2/3] Remove unused Contao Framework from the Commandos and Migrations (2) --- src/StyleManager/Sync.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/StyleManager/Sync.php b/src/StyleManager/Sync.php index ea1961e..ba0bc19 100644 --- a/src/StyleManager/Sync.php +++ b/src/StyleManager/Sync.php @@ -31,7 +31,6 @@ class Sync public function __construct(ContaoFramework $framework, Connection $connection) { $this->framework = $framework; - $this->framework->initialize(); $this->connection = $connection; } @@ -265,6 +264,8 @@ public static function mergeGroupObjects(?StyleManagerModel $objOriginal, ?Style */ public function export(?DataContainer $dc, $objArchives = null, bool $blnSendToBrowser = true) { + $this->framework->initialize(); + // Create a new XML document $xml = new DOMDocument('1.0', 'UTF-8'); $xml->formatOutput = true; From 84cbf0ae5cbd5d912bca90f12e72fb8aa2392144 Mon Sep 17 00:00:00 2001 From: doishub Date: Wed, 8 Mar 2023 14:36:51 +0100 Subject: [PATCH 3/3] Remove unused Contao Framework from the Commandos and Migrations (3) --- src/StyleManager/Sync.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/StyleManager/Sync.php b/src/StyleManager/Sync.php index ba0bc19..22fe2d5 100644 --- a/src/StyleManager/Sync.php +++ b/src/StyleManager/Sync.php @@ -41,6 +41,8 @@ public function __construct(ContaoFramework $framework, Connection $connection) */ public function shouldRunObjectConversion($table = null): bool { + $this->framework->initialize(); + $schemaManager = method_exists($this->connection, 'createSchemaManager') ? $this->connection->createSchemaManager() : $this->connection->getSchemaManager() @@ -76,6 +78,8 @@ public function shouldRunObjectConversion($table = null): bool */ public function performObjectConversion($table = null): void { + $this->framework->initialize(); + $schemaManager = method_exists($this->connection, 'createSchemaManager') ? $this->connection->createSchemaManager() : $this->connection->getSchemaManager()