skip to Main Content

How can I use a custom method in Symfony? – PHP

In my Data Repository I created a function: public function myData(){ $data = $this->createQueryBuilder('data') ->leftJoin('data.fields', 'f') ->andWhere('f.name = :field') ->setParameter('field', 'company'); $result = $data->getQuery()->execute(); return $result; } In my Controller I want to use this function: class PagesController extends AbstractController…

VIEW QUESTION

Undefined method getDoctrine – PHP

I am a beginner on Symfony 6 and I am blocked because I have an error message: "Undefined method getDoctrine" with Intelephense Here is my code: #[Route('/recettes', name: 'app_recettes')] public function index(int $id): Response { $em = $this->getDoctrine()->getManager(); $recette =…

VIEW QUESTION

Symfony Messenger Injection Doctrine – PHP

I need help for my project. I try to inject Entity Manager inside my service (SendInBlueService) call with messenger, but DependencyInjection can't find doctrine.orm.entity_manager. My test route #[Route('api/testSendInBlue', name: 'testsendinblue')] public function testMessenger(AsyncMethodService $asyncMethodService): Response { $asyncMethodService->async_low_priority( SendInBlueService::class, 'confirmationMail', […

VIEW QUESTION

How to properly populate an ArrayCollection property of a DTO using Symfony's serializer? – PHP

I have a DTO class looking like: class ParamsDto { #[AssertType(ArrayCollection::class)] #[AssertAll([ new AssertType('digit'), new AssertPositive(), ])] private ?ArrayCollection $tagIds = null; public function getTagIds(): ?ArrayCollection { return $this->tagIds; } public function setTagIds(?ArrayCollection $tagIds): self { $this->tagIds = $tagIds; return…

VIEW QUESTION
Back To Top
Search