mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Add findAllForAttendee method in NotificationRepository
This commit is contained in:
parent
e50bfd5129
commit
6ea5a3088c
@ -23,6 +23,7 @@ use Chill\MainBundle\Entity\Notification;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
|
||||||
final class NotificationRepository implements ObjectRepository
|
final class NotificationRepository implements ObjectRepository
|
||||||
{
|
{
|
||||||
@ -59,8 +60,24 @@ final class NotificationRepository implements ObjectRepository
|
|||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Notification[]
|
||||||
|
*/
|
||||||
|
public function findAllForAttendee(User $addressee) // TODO passer à attendees avec S
|
||||||
|
{
|
||||||
|
$qb = $this->repository->createQueryBuilder('n');
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->select('n')
|
||||||
|
->join('n.addressees', 'a')
|
||||||
|
->where('a = :addressee')
|
||||||
|
->setParameter('addressee', $addressee);
|
||||||
|
|
||||||
|
$query = $qb->getQuery();
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
public function getClassName() {
|
public function getClassName() {
|
||||||
return Notification::class;
|
return Notification::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user