-
-
Notifications
You must be signed in to change notification settings - Fork 74
ContainerBuilder: removeDefinition removes from classes too #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Nice addition. If you could also add tests, that would be awesome. |
|
I'm on it. |
|
It's ready now. |
|
nice 👍 |
src/DI/ContainerBuilder.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about $this->classes[$class][FALSE]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dg Added!
|
All occurrences should be removed, not only in |
|
@dg What do you mean? |
|
for example |
|
@dg I still don't undestand the point. I'm not familiar with $classes content in such depth. Could you provide failing usecase? |
|
class A extends stdClass {} $containerBuilder->addDefintion('two')->setClass('A'); |
|
This might do it. Please check. Edit: other test is failing. Will check tomorrow |
(cca, written on phone on a bike) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, and what about this? $this->classes[$class][$mode] = array_diff($this->classes[$class][$mode], [$name]).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's less readable. It might be faster, container compilation is cached though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dev code, I shall removed it.
|
Parfe! |
|
Thanx |
|
One more related bug: $someInterface => [
0 => FirstService
1 => SecondService
];Remove 'FirstService': $someInterface => [
1 => SecondService
];Then, Solution? Something like: return reset($this->classes[$class][TRUE]);What do you think? |
Use case: