Stevan Tosic Stevan Tosic - 4 months ago 23
YAML Question

Add Memcahed service to symfony2

Services:

memcached:
class: Memcached
calls:
-[addServers,[%memcached.servers%]]


Parameters:

memcached.servers:
- { host: 127.0.0.1, port: 11211 }


When I try this code I get error

Parameter "calls" must be an array for service "memcached" in
...Resources/config/services.yml. Check your YAML syntax


I try to put even inline but error is same.

Answer

This is my configurations:

config.yml

memcached:
    class: Memcached
    calls:
        - [ addServer, ['%memcached.host%', '%memcached.port%'] ]

In my config.yml the minus symbol under calls in about the s instead of the l in your case (see in the doc also).

Hope this help

Comments