mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 03:23:48 +00:00
Fix repositories to fetch entity linked to stored object
getSingleResult() replaced by getOneOrNullResult() to\ avoid error being thrown. Fix naming of properties.
This commit is contained in:
@@ -38,21 +38,16 @@ class EventRepository implements ObjectRepository, AssociatedEntityToStoredObjec
|
||||
return $this->repository->createQueryBuilder($alias, $indexBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NonUniqueResultException
|
||||
* @throws NoResultException
|
||||
*/
|
||||
public function findAssociatedEntityToStoredObject(StoredObject $storedObject): ?object
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e');
|
||||
$query = $qb
|
||||
->join('e.documents', 'ed')
|
||||
->join('ed.storedObject', 'so')
|
||||
->where('so.id = :storedObjectId')
|
||||
->where('ed.id = :storedObjectId')
|
||||
->setParameter('storedObjectId', $storedObject->getId())
|
||||
->getQuery();
|
||||
|
||||
return $query->getSingleResult();
|
||||
return $query->getOneOrNullResult();
|
||||
}
|
||||
|
||||
public function find($id)
|
||||
|
Reference in New Issue
Block a user