Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony: LoggingTranslator vs Translator

I want to inject my translations string into a service, so I used this in the service definition:

arguments: [@doctrine.orm.entity_manager, @translator]

I used this in the constructor:

public function __construct(\Doctrine\ORM\EntityManager $entityManager, \Symfony\Component\Translation\Translator $translator)

But I get this error:

.... __construct() must be an instance of Symfony\Component\Translation\Translator, instance of Symfony\Component\Translation\LoggingTranslator given...

What is the difference between the two?

like image 318
b85411 Avatar asked Mar 20 '15 08:03

b85411


1 Answers

In according with the news announcement, from the version 2.6 the translator component is defined as service like translator.default.

So change your service definition:

arguments: [@doctrine.orm.entity_manager, @translator]

with

arguments: [@doctrine.orm.entity_manager, @translator.default]
like image 67
Matteo Avatar answered Sep 28 '22 06:09

Matteo