mnapoli / assembly

[EXPERIMENTAL] Implementation of container-interop/definition-interop
MIT License
7 stars 5 forks source link

Dynamic Class Names Not Allowed #17

Open XedinUnknown opened 8 years ago

XedinUnknown commented 8 years ago

Reading through the code, I found something that concerns me. I wanted to have the class name for the service to be dependent on one of the container values. However, currently it doesn't seem possible.

I want to allow easy substitution of service implementation by storing the class name in the container. To achieve this, I wanted to wrap the class name given to my implementation of ObjectDefinitionInterface into an implementation of ParameterDefinitionInterface. However, looks like this probably won't work, since you create a reflection from a raw string value without ever attempting to resolve it.

Looks like this could easily be made possible by calling DefinitionResolver#resolveSubDefinition() on the value returned by ObjectDefinitionInterface#getClassName() first.

mnapoli commented 8 years ago

If this was a feature this should be first added to https://github.com/container-interop/definition-interop (the standard). But as I said in #16 this standard is not actively worked upon right now.