Skip to content

Commit

Permalink
TracyExtension: bar panel services are not recreated [Closes #329]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 2, 2018
1 parent 6cd6dd8 commit ab80df1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Bridges/Nette/TracyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)

if ($this->debugMode) {
foreach ((array) $this->config['bar'] as $item) {
if (is_string($item) && substr($item, 0, 1) === '@') {
$item = new Nette\DI\Statement(['@' . $builder::THIS_CONTAINER, 'getService'], [substr($item, 1)]);
} elseif (is_string($item)) {
$item = new Nette\DI\Statement($item);
}
$initialize->addBody($builder->formatPhp(
'$this->getService(?)->addPanel(?);',
$class::filterArguments([
$this->prefix('bar'),
is_string($item) ? new Nette\DI\Statement($item) : $item,
])
$class::filterArguments([$this->prefix('bar'), $item])
));
}

Expand Down

0 comments on commit ab80df1

Please sign in to comment.