Как получить объект translator в Symfony 5
Привет, TranslatorInterface.
Ранее, в Symfony 3 было так (в коде контроллера):
public function fooAction() {
//...
$t = $this->get('translator');
$t->trans('You have not access to this advert');
//...
}
Теперь стало
use Symfony\Contracts\Translation\TranslatorInterface;
//....
public function fooAction(TranslatorInterface $t) {
//...
$t->trans('You have not access to this advert');
//...
}