Passing an symfony2 associative array as an argument in a service definition issue

I am trying to pass an associative array as an argument to define a service (more precisely, Solarium). However, I get the following error:

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

My services.yml read 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 something clearly wrong with the way I defined the array of parameters?

+6
source share
1 answer

arguments should be an array, try:

 services: mynamespace.api.solrclient: class: Solarium\Client arguments: [%mynamespace.api.solrclient.config%] 
+9
source

Source: https://habr.com/ru/post/943559/


All Articles