7

I am trying to pass an associative array as argument to a service definition (Solarium, to be precise). However, I get the following error:

"Catchable Fatal Error: Argument 1 passed to Symfony\Component\DependencyInjection\Definition::setArguments() must be of the type array, string given, "

My services.yml reads as follows:

parameters:
    mynamespace.api.solrclient.config: 
        endpoint:
            solrserver:
                host: "search.mysite.com"
                port: "80"
                path: "/solr/"

services:        
    mynamespace.api.solrclient:
        class: Solarium\Client
        arguments: "%mynamespace.api.solrclient.config%"

Is there anything obviously wrong with the way I have defined the parameter array?

1 Answer 1

12

arguments must be an array, try:

services:
    mynamespace.api.solrclient:
        class: Solarium\Client
        arguments: [%mynamespace.api.solrclient.config%]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.