Lines
100.00%
7 / 7
Methods
100.00%
3 / 3
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| findByOwner | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| findDatedByOwner | 100.00% | 5 / 5 | 100.00% | 1 / 1 | 1 | ||
| 17 | class DoneBannerRepository extends ServiceEntityRepository | |
| 18 | { | |
| 19 | public function __construct(ManagerRegistry $registry) | |
| 20 | { | |
| 21 | parent::__construct($registry, DoneBanner::class); | |
| 22 | } | |
| 23 | ||
| 24 | /** | |
| 25 | * @return list<DoneBanner> newest on the done list first | |
| 26 | */ | |
| 27 | public function findByOwner(User $owner): array | |
| 28 | { | |
| 29 | return $this->findBy(['owner' => $owner], ['position' => 'ASC']); | |
| 30 | } | |
| 31 | ||
| 32 | /** | |
| 33 | * @return list<DoneBanner> those with a day, newest first | |
| 34 | */ | |
| 35 | public function findDatedByOwner(User $owner): array | |
| 36 | { | |
| 37 | $criteria = Criteria::create() | |
| 38 | ->where(Criteria::expr()->eq('owner', $owner)) | |
| 39 | ->andWhere(Criteria::expr()->neq('doneAt', null)) | |
| 40 | ->orderBy(['doneAt' => Order::Descending, 'position' => Order::Ascending]); | |
| 41 | ||
| 42 | return \array_values($this->matching($criteria)->toArray()); | |
| 43 | } | |
| 44 | } |