-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Injections on bound class #62
Comments
Hi, Yes it is by design. If you have a configuration like so: <?php
return [
'Phoriz\Session\SessionHandler' => [
'class' => 'Phoriz\Session\FileSession\FileSessionHandler',
'properties' => [
'foo' => 1,
],
],
'Phoriz\Session\FileSession\FileSessionHandler' => [
'properties' => [
'foo' => 2,
],
],
]; The first configuration is what you get for: The second configuration is what you get for: Basically they are different entries. However if you use annotations, then annotations should be taken into account on both the interface and the implementation! If that is not the case, that is a real bug. Let me know. |
Hi It worked in version 2.1 (using alias), it would be really usefull to have the alias back or the annotations taken into account on the implementation. |
OK I see, I reproduced it in tests. I will look into that. |
great, let me know if there is anything i can do to help |
The more I think about it, the more I believe you are right about aliasing. I don't see any reason this shouldn't be a feature: return [
'Phoriz\Session\SessionHandler' => [
'class' => 'Phoriz\Session\FileSession\FileSessionHandler',
],
'Phoriz\Session\FileSession\FileSessionHandler' => [
'properties' => [
'foo' => 2,
],
],
]; By "merging" the definition of the alias into the current definition (i.e. by merging the implementation definition into the interface), that allows for simple aliasing. And that solves the current problem with annotations. That would also allow to have the same behavior between annotations and other definition formats (array, yaml...). Everything would be simpler. What do you think about it? |
That sunds like a very good solution. |
DefinitionManager::getDefinition now merges definitions when using aliases (#62) Cache has been moved into DefinitionManager: simpler and now caches DefinitionManager::getDefinition logic
I released 3.0.1 with the fix for this bug. Let me know if there's any problem. |
It looks like implementations of an interface does not get "injections"
Eg:
$container->set('Phoriz\Session\SessionHandler')
->bindTo('Phoriz\Session\FileSession\FileSessionHandler');
It looks like Phoriz\Session\SessionHandler gets it properties injected, but Phoriz\Session\FileSession\FileSessionHandler does not.
Is this by design?
The text was updated successfully, but these errors were encountered: