From a8404a33bdae133d704b0a9e0c0431f3471ee760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20=C3=81lvarez?= Date: Tue, 24 May 2022 14:26:59 +0200 Subject: [PATCH] none --- src/Repository/MerServiceRepository.php | 8 +++++++- templates/index/notificationDm.html.twig | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Repository/MerServiceRepository.php b/src/Repository/MerServiceRepository.php index 6f0bd10..133370e 100644 --- a/src/Repository/MerServiceRepository.php +++ b/src/Repository/MerServiceRepository.php @@ -65,6 +65,12 @@ class MerServiceRepository extends ServiceEntityRepository // ; // } + /* + * offer_id is in MerDM, a trait used by MerParaDM for example. + * This field can't be used in MerService, so the idea is to do + * a partial load, and then refresh() the object to get all the + * fields. + */ public function findByOfferId(int $offerId) { // return $this->createQueryBuilder('s') @@ -81,7 +87,7 @@ class MerServiceRepository extends ServiceEntityRepository $rsm->setDiscriminatorColumn('s', 'discr'); $query = $this->getEntityManager() - ->createNativeQuery('SELECT * FROM mer_service m WHERE offer_id = :offer_id', $rsm); + ->createNativeQuery('SELECT m.id, m.discr FROM mer_service m WHERE offer_id = :offer_id', $rsm); $query->setParameter('offer_id', $offerId); $res = $query->getResult(); diff --git a/templates/index/notificationDm.html.twig b/templates/index/notificationDm.html.twig index ac8c6b5..161904e 100644 --- a/templates/index/notificationDm.html.twig +++ b/templates/index/notificationDm.html.twig @@ -4,7 +4,7 @@ {% block body %}

check profiler output

- +

MerServiceRepository->findByOfferId

{{ dump(serviceRepo) }}