I'm trying to inject an object into one of my services, as well as another service. The second argument is just an object, however when declaring it in the services.yml file, I receive an exception staying that its expecting an object, but a string was given.
services.yml
parameters:
app.my_class.class: AppBundle\MyClass
app.object_to_inject.class: AppBundle\InjectObject
services:
app.my_service:
class: %app.my_class.class%
arguments: [@app.another_service, %app.object_to_inject.class%]
Which results in:
Catchable Fatal Error: Argument 2 passed to AppBundle\MyClass::__construct() must be an instance of AppBundle\InjectObject, string given
I've tried quoting, unquoting and using new lines instead of square brackets:
arguments
- @app.another_service
- %app.object_to_inject.class%