Skip to content

Commit

Permalink
Allow shorten statement in service declaration [Fixes #2]
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka committed Feb 20, 2013
1 parent 97781d7 commit 6c74a4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Kdyby/Events/DI/EventsExtension.php
Expand Up @@ -169,7 +169,9 @@ private function autowireEvents(Nette\DI\ContainerBuilder $builder)
foreach ($builder->getDefinitions() as $def) {
/** @var Nette\DI\ServiceDefinition $def */
if (!class_exists($class = $builder->expand($def->class))) {
continue;
if (!$def->factory || !class_exists($class = $builder->expand($def->factory->entity))) {
continue;
}
}

$properties = Nette\Reflection\ClassType::from($class)->getProperties(Nette\Reflection\Property::IS_PUBLIC);
Expand Down
4 changes: 4 additions & 0 deletions tests/KdybyTests/Events/config/autowire.neon
Expand Up @@ -3,3 +3,7 @@ events:
validate: no
autowire: yes

services:
application:
class: NULL
factory: Nette\Application\Application

0 comments on commit 6c74a4c

Please sign in to comment.