This commit is contained in:
Sergio Álvarez 2022-05-24 14:26:59 +02:00
parent d42bfa124a
commit a8404a33bd
No known key found for this signature in database
GPG Key ID: 622780889DFDBDA5
2 changed files with 8 additions and 2 deletions

View File

@ -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();

View File

@ -4,7 +4,7 @@
{% block body %}
<p>check profiler output</p>
<h1>MerServiceRepository->findByOfferId</h1>
{{ dump(serviceRepo) }}