Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Injections on bound class #62
It looks like implementations of an interface does not get "injections"
It looks like Phoriz\Session\SessionHandler gets it properties injected, but Phoriz\Session\FileSession\FileSessionHandler does not.
Is this by design?
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.
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.
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?