-
-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
#71 #72 broke InjectExtension. When another extension override definition with own definition, it removes class from $classes, but ->addDefinition does not add new.
certain description (see link):
- $classes is prepared by https://github.com/nette/di/blob/master/src/DI/Compiler.php#L202
- OrmExtension override definition https://github.com/Kdyby/Doctrine/blob/master/src/Kdyby/Doctrine/DI/OrmExtension.php#L741 (beforeCompile) - remove $classes https://github.com/nette/di/blob/master/src/DI/ContainerBuilder.php#L81
- Next extension (InjectExtension) want to service by class in beforeCompile https://github.com/nette/di/blob/master/src/DI/Extensions/InjectExtension.php#L126 (btw. see second param which missing)
- there is null https://github.com/nette/di/blob/master/src/DI/ContainerBuilder.php#L210
testcase:
$builder = new DI\ContainerBuilder;
$builder->addDefinition('one')
->setClass('stdClass');
$builder->prepareClassList();
$builder->removeDefinition('one');
$builder->addDefinition('one')
->setClass('stdClass');
Assert::count(1, $builder->findByType('stdClass')); // Failed: Count 0 should be 1
Assert::same('one', $builder->getByType('stdClass')); // Failed: NULL should be 'one'
Metadata
Metadata
Assignees
Labels
No labels