Skip to content

Commit

Permalink
ApplicationExtension: presenters are not autowired
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 11, 2019
1 parent 42cb514 commit e0c3c06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Bridges/ApplicationDI/ApplicationExtension.php
Expand Up @@ -115,7 +115,8 @@ public function beforeCompile()
} }


foreach ($all as $def) { foreach ($all as $def) {
$def->addTag(Nette\DI\Extensions\InjectExtension::TAG_INJECT); $def->addTag(Nette\DI\Extensions\InjectExtension::TAG_INJECT)
->setAutowired(false);


if (is_subclass_of($def->getType(), UI\Presenter::class)) { if (is_subclass_of($def->getType(), UI\Presenter::class)) {
$def->addSetup('$invalidLinkMode', [$this->invalidLinkMode]); $def->addSetup('$invalidLinkMode', [$this->invalidLinkMode]);
Expand Down
3 changes: 2 additions & 1 deletion tests/Bridges.DI/ApplicationExtension.scan.phpt
Expand Up @@ -75,5 +75,6 @@ test(function () {
Assert::count(1, $container->findByType(Presenter1::class)); Assert::count(1, $container->findByType(Presenter1::class));
Assert::count(1, $container->findByType(Presenter2::class)); Assert::count(1, $container->findByType(Presenter2::class));


Assert::same('test', $container->getByType(Presenter1::class)->getView()); $name = $container->findByType(Presenter1::class)[0];
Assert::same('test', $container->createService($name)->getView());
}); });

0 comments on commit e0c3c06

Please sign in to comment.