Skip to content

Commit

Permalink
Merge pull request #81 from oveleon/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
doishub authored Mar 8, 2023
2 parents 38d1118 + 84cbf0a commit 796fb89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
8 changes: 1 addition & 7 deletions src/Command/ObjectConversionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
12 changes: 1 addition & 11 deletions src/Migration/Version30/ObjectConversionMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
7 changes: 6 additions & 1 deletion src/StyleManager/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class Sync
public function __construct(ContaoFramework $framework, Connection $connection)
{
$this->framework = $framework;
$this->framework->initialize();
$this->connection = $connection;
}

Expand All @@ -42,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()
Expand Down Expand Up @@ -77,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()
Expand Down Expand Up @@ -265,6 +268,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;
Expand Down

0 comments on commit 796fb89

Please sign in to comment.