From 91110c037e9c71cfd71826b732ddd98acc7124a5 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Sun, 22 Dec 2024 22:57:52 +0000 Subject: [PATCH] Add method to retrieve ordered staff notes --- src/Repository/StaffNoteRepository.php | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 // */