Stevan Tosic
Stevan Tosic

Reputation: 7209

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.

Upvotes: 3

Views: 102

Answers (2)

Matteo
Matteo

Reputation: 39390

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

Upvotes: 1

intrigatory57
intrigatory57

Reputation: 98

Your YAML is invalid. It should be:

  - [addServers,[%memcached.servers%]]

at the end of the block

Upvotes: 0

Related Questions