问题描述:

I'm having a hard time tryig to acces entityManager from a service.

Here's the error thrown :

You cannot dump a container with parameters that contain references to other services (reference to service "doctrine.orm.entity_manager" found in "/em")

Service Class :

class ImpressionClassementService{

protected $em;

public function __construct(EntityManager $entityManager, $parameters)

{

$this->em = $entityManager;

$this->parameters = $parameters;

}

public function imprimerAction()

{ ...}

}

services.yml :

services:

paces_colle.imprimerclassement:

class: PACES\ColleBundle\Services\ImpressionClassementService

arguments: ['%em%', '%parameters%']

parameters.yml :

parameters:

parameters: ''

em: '@doctrine.orm.entity_manager'

Parameters is an argument set when I call the service so it's blank here.

相关阅读:
Top