Skip to content

Commit

Permalink
Merge pull request #48 from MartkCz/master
Browse files Browse the repository at this point in the history
Registration of bar is moved to afterCompile, removed short array syntax
  • Loading branch information
stekycz authored Oct 4, 2016
2 parents 3588344 + 6f11039 commit 1d3e6e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Cronner/DI/CronnerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Nette\DI\Compiler;
use Nette\DI\CompilerExtension;
use Nette\DI\Statement;
use Nette\PhpGenerator\ClassType;
use Nette\Utils\Json;
use Nette\Utils\Validators;

Expand Down Expand Up @@ -109,10 +110,14 @@ public function beforeCompile()
foreach (array_keys($builder->findByTag(self::TASKS_TAG)) as $serviceName) {
$runner->addSetup('addTasks', array('@' . $serviceName));
}
}

public function afterCompile(ClassType $class) {
$builder = $this->getContainerBuilder();
$init = $class->getMethod('initialize');

if ($builder->hasDefinition($this->prefix('bar'))) {
$builder->getDefinition('tracy.bar')
->addSetup('addPanel', array($this->prefix('@bar')));
$init->addBody('$this->getByType(?)->addPanel($this->getService(?));', array('Tracy\Bar', $this->prefix('bar')));
}
}

Expand All @@ -126,4 +131,4 @@ public static function register(Configurator $configurator)
};
}

}
}

0 comments on commit 1d3e6e5

Please sign in to comment.