Category: service

Routing in service and contoller of symfony 3.4

I am a situation that when i create a url in my controller as $projectInvestorDecline = $this->generateUrl( ‘project_investor_decline’, [ ‘project’ => 1, ‘uuid’=>$sucInvestorContact->getUuid() ], UrlGeneratorInterface::ABSOLUTE_URL ); dump($projectInvestorDecline); die; I am getting the output as “http://localhost:8080/app_dev.php/project/decline/1/526f1de7-83d6-11ea-bef1-00e02d4a14d4” which is correct .But when…

requestStack getCurrentRequest is null in service while loading data with Doctrine-Fixture

So, this is my first post in stackoverflow, sorry if I missed some mandatory information. Let me explain the issue I’m facing. While trying to load data use Doctrine-fixture command: php bin/console doctrine:fixture:load -e test, I’m getting the following error:…

How to automatically call a service in symfony 4

I have a service in my project services: exemple.annotation_reader: class: AppAnnotationModelAnnotationReader public: true arguments: [“@annotations.reader”] calls: – [getAnnotation] And I want call the methode “getAnnotation” without adding this line in my controller $this->get(‘exemple.annotation_reader’)->getAnnotation(); And there is my function getAnnotation public…

removed MessageSelector in Symfony/Component/Translation

I just tried to upgrade to Symfony 5.0, however, I get the following error: You have requested a non-existent service “translator.selector”. In my code in services.yaml I have SymfonyComponentTranslationMessageSelector: ‘@translator.selector’ https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Translation/CHANGELOG.md I saw that it was removed. How should I…