diff --git a/src/Repository/StaffNoteRepository.php b/src/Repository/StaffNoteRepository.php index e801791..a2052ab 100644 --- a/src/Repository/StaffNoteRepository.php +++ b/src/Repository/StaffNoteRepository.php @@ -2,6 +2,7 @@ namespace App\Repository; +use App\Entity\MemberCase; use App\Entity\StaffNote; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; @@ -16,6 +17,16 @@ class StaffNoteRepository extends ServiceEntityRepository parent::__construct($registry, StaffNote::class); } + public function getOrderedNotes(MemberCase $case): array + { + return $this->createQueryBuilder('s') + ->andWhere('s.memberCase = :case') + ->setParameter('case', $case->getId()->toBinary()) + ->orderBy('s.date', 'DESC') + ->getQuery() + ->getResult(); + } + // /** // * @return StaffNote[] Returns an array of StaffNote objects // */