assembly icon indicating copy to clipboard operation
assembly copied to clipboard

Dynamic Class Names Not Allowed

Open XedinUnknown opened this issue 9 years ago • 1 comments

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.

XedinUnknown avatar Mar 13 '16 15:03 XedinUnknown

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.

mnapoli avatar Mar 13 '16 22:03 mnapoli