Skip to content

Commit

Permalink
Merge pull request #2 from ipublikuj/nette30
Browse files Browse the repository at this point in the history
Task: Better nette 3 support
  • Loading branch information
akadlec authored Nov 15, 2019
2 parents af3d20c + b19a0e2 commit ed1ebcd
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/IPub/DoctrineConsistence/DI/DoctrineConsistenceExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public function loadConfiguration() : void
{
// Get container builder
$builder = $this->getContainerBuilder();

// Merge extension default config
$this->setConfig(DI\Config\Helpers::merge($this->config, DI\Helpers::expand($this->defaults, $builder->parameters)));

// Get extension configuration
$configuration = $this->getConfig();
/** @var array $configuration */
if (method_exists($this, 'validateConfig')) {
$configuration = $this->validateConfig($this->defaults);
} else {
$configuration = $this->getConfig($this->defaults);
}

if ($configuration['subscriber']['tag']) {
$builder->addDefinition($this->prefix('subscriber'))
Expand All @@ -77,14 +77,12 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class) : void
{
parent::afterCompile($class);

// Get container builder
$builder = $this->getContainerBuilder();

// Merge extension default config
$this->setConfig(DI\Config\Helpers::merge($this->config, DI\Helpers::expand($this->defaults, $builder->parameters)));

// Get extension configuration
$configuration = $this->getConfig();
/** @var array $configuration */
if (method_exists($this, 'validateConfig')) {
$configuration = $this->validateConfig($this->defaults);
} else {
$configuration = $this->getConfig($this->defaults);
}

/** @var Nette\PhpGenerator\Method $initialize */
$initialize = $class->getMethods()['initialize'];
Expand Down

0 comments on commit ed1ebcd

Please sign in to comment.