JohnPoe
JohnPoe

Reputation: 61

Symfony 2.1 - injecting entity_manager to services.yml

I'm trying to inject the entity_manager to my service but, whatever I try it doesn't work. Thera are some different approaches on the web, so which is the correct?

services:
menu:
    class: AppBundle\Service\Menu
    arguments:    ["@doctrine.orm.entity_manager"]

or

services:
menu:
    class: AppBundle\Service\Menu
    arguments:    [@doctrine.orm.entity_manager]

both don't work and give me a

The file "D:\xamp\htdocs\icp\app/config\services.yml" does not contain valid YAML

What I'm doing wrong?

Upvotes: 0

Views: 54

Answers (1)

Federkun
Federkun

Reputation: 36934

Watch out for spaces. With YAML they are very important.

services:
    menu:
        class: AppBundle\Service\Menu
        arguments: ["@doctrine.orm.entity_manager"]

Upvotes: 3

Related Questions