diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityReasonCategoryRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityReasonCategoryRepository.php new file mode 100644 index 000000000..3026105b0 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityReasonCategoryRepository.php @@ -0,0 +1,23 @@ +, - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ +declare(strict_types=1); namespace Chill\ActivityBundle\Repository; @@ -29,10 +11,10 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; /** - * @method AccompanyingPeriodParticipation|null find($id, $lockMode = null, $lockVersion = null) - * @method AccompanyingPeriodParticipation|null findOneBy(array $criteria, array $orderBy = null) - * @method AccompanyingPeriodParticipation[] findAll() - * @method AccompanyingPeriodParticipation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + * @method Activity|null find($id, $lockMode = null, $lockVersion = null) + * @method Activity|null findOneBy(array $criteria, array $orderBy = null) + * @method Activity[] findAll() + * @method Activity[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class ActivityRepository extends ServiceEntityRepository { @@ -42,12 +24,7 @@ class ActivityRepository extends ServiceEntityRepository } /** - * @param $person - * @param array $scopes - * @param string[] $orderBy - * @param int $limit - * @param int $offset - * @return array|Activity[] + * @return Activity[] */ public function findByPersonImplied(Person $person, array $scopes, ?array $orderBy = [ 'date' => 'DESC'], ?int $limit = 100, ?int $offset = 0): array { @@ -63,8 +40,7 @@ class ActivityRepository extends ServiceEntityRepository ':person MEMBER OF a.persons' ) ) - ->setParameter('person', $person) - ; + ->setParameter('person', $person); foreach ($orderBy as $k => $dir) { $qb->addOrderBy('a.'.$k, $dir); @@ -72,17 +48,11 @@ class ActivityRepository extends ServiceEntityRepository $qb->setMaxResults($limit)->setFirstResult($offset); - return $qb->getQuery() - ->getResult(); + return $qb->getQuery()->getResult(); } /** - * @param AccompanyingPeriod $period - * @param array $scopes - * @param int|null $limit - * @param int|null $offset - * @param array|string[] $orderBy - * @return array|Activity[] + * @return Activity[] */ public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array { @@ -92,8 +62,7 @@ class ActivityRepository extends ServiceEntityRepository if (!$allowNullScope) { $qb ->where($qb->expr()->in('a.scope', ':scopes')) - ->setParameter('scopes', $scopes) - ; + ->setParameter('scopes', $scopes); } else { $qb ->where( @@ -102,16 +71,14 @@ class ActivityRepository extends ServiceEntityRepository $qb->expr()->isNull('a.scope') ) ) - ->setParameter('scopes', $scopes) - ; + ->setParameter('scopes', $scopes); } $qb ->andWhere( $qb->expr()->eq('a.accompanyingPeriod', ':period') ) - ->setParameter('period', $period) - ; + ->setParameter('period', $period); foreach ($orderBy as $k => $dir) { $qb->addOrderBy('a.'.$k, $dir); @@ -119,7 +86,6 @@ class ActivityRepository extends ServiceEntityRepository $qb->setMaxResults($limit)->setFirstResult($offset); - return $qb->getQuery() - ->getResult(); + return $qb->getQuery()->getResult(); } } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php new file mode 100644 index 000000000..5e4076ce5 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityTypeRepository.php @@ -0,0 +1,23 @@ +