Problem Inject list of object
eerison opened this issue · comments
When I try to pass a list of objects as arguments, It isn' working It's injecting className and not Object.
->addArgument([Object1:class, Object2:class])
addArgument
expects one argument, addArguments
expects an array of arguments
Serializer(array $normalizers, array $enconders) {}
I need to pass this way
New Serializer([new ObjectNormalizer()], [new JsonEncoder()])
It's the problem, I think the addArguments() can't help me with
You'd be better off using a callable as a factory for the item:
https://container.thephpleague.com/3.x/dependency-injection/#factories
Or using tags to create an array of items:
https://container.thephpleague.com/3.x/definitions/#features
Yeah I saw it I think it can help me
Thanks @philipobenito