Im using PHP Symfony 4.4, and inside on the action in SearchController, ive got this part of the code:
$translatableListener = $this->get('gedmo.listener.translatable');
$carsRepository = $this->getCarsTranslationsRepository();
$locale = $translatableListener->getListenerLocale();
When I click the search button it shows me this issue:
The "gedmo.listener.translatable" service or alias has been removed or inlined when the container was compiled. You should either make it public or stop using the container directly and use dependency injection instead.
I tried to solve this by adding this part of the code in the services.yml
gedmo.listener.translatable:
class: Gedmo\Translatable\TranslatableListener
public: true
tags:
- { name: doctrine.event_subscriber, connection: default }
However this still does not works, any help?
solution:
$translationListener = new Gedmo\Translatable\TranslatableListener();