mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-02-27 10:39:40 +00:00
Merge branch 'refs/heads/master' into ticket-app-master
# Conflicts: # composer.json # config/bundles.php # config/packages/doctrine_migrations_chill.yaml # package.json # src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUserGroup.php # src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php # src/Bundle/ChillMainBundle/Entity/UserGroup.php # src/Bundle/ChillMainBundle/Resources/public/chill/js/date.ts # src/Bundle/ChillMainBundle/Resources/public/lib/download-report/download-report.js # src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts # src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts # src/Bundle/ChillMainBundle/Resources/public/page/export/download-export.js # src/Bundle/ChillMainBundle/Resources/public/types.ts # src/Bundle/ChillMainBundle/Resources/views/Dev/dev.assets.html.twig # src/Bundle/ChillMainBundle/Templating/Entity/UserGroupRender.php # src/Bundle/ChillMainBundle/chill.api.specs.yaml # src/Bundle/ChillMainBundle/chill.webpack.config.js # src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/WriteComment.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Household.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/MemberDetails.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonRenderBox.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue # src/Bundle/ChillPersonBundle/Resources/public/vuejs/_js/i18n.ts # tests/app/config/bootstrap.php
This commit is contained in:
@@ -11,12 +11,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
|
||||
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\DocStoreBundle\Repository\AssociatedEntityToStoredObjectInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\NonUniqueResultException;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
class AccompanyingPeriodWorkEvaluationDocumentRepository implements ObjectRepository
|
||||
class AccompanyingPeriodWorkEvaluationDocumentRepository implements ObjectRepository, AssociatedEntityToStoredObjectInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
@@ -58,4 +61,18 @@ class AccompanyingPeriodWorkEvaluationDocumentRepository implements ObjectReposi
|
||||
{
|
||||
return AccompanyingPeriodWorkEvaluationDocument::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NonUniqueResultException
|
||||
*/
|
||||
public function findAssociatedEntityToStoredObject(StoredObject $storedObject): ?AccompanyingPeriodWorkEvaluationDocument
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('acpwed');
|
||||
$query = $qb
|
||||
->where('acpwed.storedObject = :storedObject')
|
||||
->setParameter('storedObject', $storedObject)
|
||||
->getQuery();
|
||||
|
||||
return $query->getOneOrNullResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
* @method AccompanyingPeriodWorkGoal[] findAll()
|
||||
* @method AccompanyingPeriodWorkGoal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
final class AccompanyingPeriodWorkGoalRepository
|
||||
final readonly class AccompanyingPeriodWorkGoalRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -22,11 +22,11 @@ use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final readonly class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||
class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
public function __construct(private EntityManagerInterface $em)
|
||||
public function __construct(private readonly EntityManagerInterface $em)
|
||||
{
|
||||
$this->repository = $em->getRepository(AccompanyingPeriodWork::class);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class CommentRepository
|
||||
final readonly class CommentRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class OriginRepository
|
||||
final readonly class OriginRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class ResourceRepository
|
||||
final readonly class ResourceRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin
|
||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||
private Security $security,
|
||||
private AuthorizationHelperForCurrentUserInterface $authorizationHelper,
|
||||
private CenterResolverManagerInterface $centerResolver
|
||||
private CenterResolverManagerInterface $centerResolver,
|
||||
) {}
|
||||
|
||||
public function buildQueryOpenedAccompanyingCourseByUserAndPostalCodes(?User $user, array $postalCodes = []): QueryBuilder
|
||||
@@ -108,7 +108,7 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin
|
||||
string $role,
|
||||
?array $orderBy = [],
|
||||
?int $limit = null,
|
||||
?int $offset = null
|
||||
?int $offset = null,
|
||||
): array {
|
||||
$qb = $this->accompanyingPeriodRepository->createQueryBuilder('ap');
|
||||
$scopes = $this->authorizationHelper
|
||||
@@ -365,4 +365,90 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function findByUserAssociation(User $user, array $steps, ?\DateTimeImmutable $from, ?\DateTimeImmutable $to, int $filter, ?int $start = 0, ?int $limit = 1000): array
|
||||
{
|
||||
$qb = $this->buildQueryByUserAssociation($user, $steps, $from, $to, $filter);
|
||||
|
||||
$qb->addOrderBy('acp.openingDate', 'DESC');
|
||||
|
||||
if (null !== $start) {
|
||||
$qb->setFirstResult($start);
|
||||
}
|
||||
if (null !== $limit) {
|
||||
$qb->setMaxResults($limit);
|
||||
}
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function countByUserAssociation(User $user, array $steps, ?\DateTimeImmutable $from, ?\DateTimeImmutable $to, int $filter): int
|
||||
{
|
||||
$qb = $this->buildQueryByUserAssociation($user, $steps, $from, $to, $filter);
|
||||
|
||||
$qb->select('COUNT(DISTINCT acp.id)');
|
||||
|
||||
return $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function buildQueryByUserAssociation(User $user, array $steps, ?\DateTimeImmutable $from, ?\DateTimeImmutable $to, int $filter): QueryBuilder
|
||||
{
|
||||
$qb = $this->accompanyingPeriodRepository->createQueryBuilder('acp');
|
||||
|
||||
// Create an andX expression to hold the user association conditions
|
||||
$whereUserAssociation = $qb->expr()->andX();
|
||||
|
||||
if (($filter & self::USER_IS_REFERRER) > 0) {
|
||||
$whereUserAssociation->add($qb->expr()->eq('acp.user', ':user'));
|
||||
}
|
||||
|
||||
if (($filter & self::USER_IS_WORK_REFERRER) > 0) {
|
||||
$whereUserAssociation->add(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1
|
||||
FROM '.AccompanyingPeriod\AccompanyingPeriodWork::class.' subw
|
||||
JOIN subw.referrersHistory subw_ref_history
|
||||
WHERE subw.id = acpw.id
|
||||
AND subw_ref_history.user = :user
|
||||
AND subw_ref_history.endDate IS NULL'
|
||||
)
|
||||
);
|
||||
|
||||
$qb->innerJoin('acp.works', 'acpw');
|
||||
}
|
||||
|
||||
if (($filter & self::USER_IS_INTERVENING) > 0) {
|
||||
|
||||
$expr = 'SELECT 1
|
||||
FROM '.AccompanyingPeriod\AccompanyingPeriodInfo::class.' info
|
||||
WHERE info.accompanyingPeriod = acp
|
||||
AND info.user = :user';
|
||||
|
||||
if (null !== $from) {
|
||||
$expr .= ' AND info.infoDate >= :from';
|
||||
$qb->setParameter('from', $from);
|
||||
}
|
||||
|
||||
if (null !== $to) {
|
||||
$expr .= ' AND info.infoDate <= :to';
|
||||
$qb->setParameter('to', $to);
|
||||
}
|
||||
|
||||
$whereUserAssociation->add(
|
||||
$qb->expr()->exists($expr)
|
||||
);
|
||||
}
|
||||
|
||||
// Apply the compound condition to the query builder
|
||||
$qb->andWhere($whereUserAssociation);
|
||||
|
||||
// Apply the steps condition
|
||||
$qb->andWhere($qb->expr()->in('acp.step', ':steps'));
|
||||
|
||||
// Set the remaining parameters
|
||||
$qb->setParameter('user', $user)
|
||||
->setParameter('steps', $steps);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,22 @@ use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
interface AccompanyingPeriodACLAwareRepositoryInterface
|
||||
{
|
||||
public const USER_IS_REFERRER = 0b0010; // 2 in decimal
|
||||
public const USER_IS_WORK_REFERRER = 0b0100; // 4 in decimal
|
||||
public const USER_IS_INTERVENING = 0b1000; // 8 in decimal
|
||||
|
||||
/**
|
||||
* Finds associations for a given user within a specific date range and step filters.
|
||||
*
|
||||
* @param \DateTimeImmutable|null $from the start date for filtering when intervention in accompanying period took place
|
||||
* @param \DateTimeImmutable|null $to the end date for filtering when intervention in accompanying period took place
|
||||
*
|
||||
* @return array the list of user associations matching the given criteria
|
||||
*/
|
||||
public function findByUserAssociation(User $user, array $steps, ?\DateTimeImmutable $from, ?\DateTimeImmutable $to, int $filter, ?int $start = 0, ?int $limit = 1000): array;
|
||||
|
||||
public function countByUserAssociation(User $user, array $steps, ?\DateTimeImmutable $from, ?\DateTimeImmutable $to, int $filter): int;
|
||||
|
||||
/**
|
||||
* @param array|UserJob[] $jobs
|
||||
* @param array|Scope[] $services
|
||||
@@ -41,7 +57,7 @@ interface AccompanyingPeriodACLAwareRepositoryInterface
|
||||
string $role,
|
||||
?array $orderBy = [],
|
||||
?int $limit = null,
|
||||
?int $offset = null
|
||||
?int $offset = null,
|
||||
): array;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class AccompanyingPeriodParticipationRepository
|
||||
final readonly class AccompanyingPeriodParticipationRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class AccompanyingPeriodRepository implements ObjectRepository
|
||||
final readonly class AccompanyingPeriodRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
@@ -62,6 +62,18 @@ final class AccompanyingPeriodRepository implements ObjectRepository
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?AccompanyingPeriod
|
||||
{
|
||||
return $this->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return AccompanyingPeriod::class;
|
||||
}
|
||||
|
||||
// CUSTOM FIND BY METHODS
|
||||
|
||||
/**
|
||||
* @return array|AccompanyingPeriod[]
|
||||
*/
|
||||
@@ -87,16 +99,6 @@ final class AccompanyingPeriodRepository implements ObjectRepository
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?AccompanyingPeriod
|
||||
{
|
||||
return $this->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return AccompanyingPeriod::class;
|
||||
}
|
||||
|
||||
private function buildQueryByRecentUserHistory(User $user, \DateTimeImmutable $since): QueryBuilder
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('a');
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Repository;
|
||||
|
||||
use Chill\PersonBundle\Entity\AdministrativeStatus;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class AdministrativeStatusRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, AdministrativeStatus::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Repository;
|
||||
|
||||
use Chill\PersonBundle\Entity\EmploymentStatus;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class EmploymentStatusRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, EmploymentStatus::class);
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ final readonly class HouseholdACLAwareRepository implements HouseholdACLAwareRep
|
||||
public function findByAddressReference(
|
||||
AddressReference $addressReference,
|
||||
?int $firstResult = 0,
|
||||
?int $maxResult = 50
|
||||
?int $maxResult = 50,
|
||||
): array {
|
||||
$qb = $this->buildQueryByAddressReference($addressReference);
|
||||
$qb = $this->addACL($qb);
|
||||
|
||||
@@ -24,6 +24,6 @@ interface HouseholdACLAwareRepositoryInterface
|
||||
public function findByAddressReference(
|
||||
AddressReference $addressReference,
|
||||
?int $firstResult = 0,
|
||||
?int $maxResult = 50
|
||||
?int $maxResult = 50,
|
||||
): array;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdComposition;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class HouseholdCompositionRepository implements HouseholdCompositionRepositoryInterface
|
||||
final readonly class HouseholdCompositionRepository implements HouseholdCompositionRepositoryInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class HouseholdCompositionTypeRepository implements HouseholdCompositionTypeRepositoryInterface
|
||||
final readonly class HouseholdCompositionTypeRepository implements HouseholdCompositionTypeRepositoryInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class HouseholdMembersRepository
|
||||
final readonly class HouseholdMembersRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class HouseholdRepository implements ObjectRepository
|
||||
final readonly class HouseholdRepository implements ObjectRepository
|
||||
{
|
||||
private const SQL_BY_ACCOMPANYING_PERIOD_PARTICIPATION = <<<'SQL'
|
||||
WITH participations AS (
|
||||
@@ -40,9 +40,9 @@ final class HouseholdRepository implements ObjectRepository
|
||||
SELECT {select} FROM households {limits}
|
||||
SQL;
|
||||
|
||||
private readonly EntityManagerInterface $em;
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class PersonHouseholdAddressRepository implements ObjectRepository
|
||||
final readonly class PersonHouseholdAddressRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
|
||||
@@ -18,9 +18,9 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class PositionRepository implements ObjectRepository
|
||||
final readonly class PositionRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -36,10 +36,10 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor
|
||||
?\DateTimeInterface $birthdate = null,
|
||||
?\DateTimeInterface $birthdateBefore = null,
|
||||
?\DateTimeInterface $birthdateAfter = null,
|
||||
?string $gender = null,
|
||||
?int $gender = null,
|
||||
?string $countryCode = null,
|
||||
?string $phonenumber = null,
|
||||
?string $city = null
|
||||
?string $city = null,
|
||||
): SearchApiQuery {
|
||||
$query = $this->createSearchQuery(
|
||||
$default,
|
||||
@@ -64,10 +64,10 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor
|
||||
?\DateTimeInterface $birthdate = null,
|
||||
?\DateTimeInterface $birthdateBefore = null,
|
||||
?\DateTimeInterface $birthdateAfter = null,
|
||||
?string $gender = null,
|
||||
?int $gender = null,
|
||||
?string $countryCode = null,
|
||||
?string $phonenumber = null,
|
||||
?string $city = null
|
||||
?string $city = null,
|
||||
): int {
|
||||
$query = $this->buildAuthorizedQuery(
|
||||
$default,
|
||||
@@ -98,10 +98,10 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor
|
||||
?\DateTimeInterface $birthdate = null,
|
||||
?\DateTimeInterface $birthdateBefore = null,
|
||||
?\DateTimeInterface $birthdateAfter = null,
|
||||
?string $gender = null,
|
||||
?int $gender = null,
|
||||
?string $countryCode = null,
|
||||
?string $phonenumber = null,
|
||||
?string $city = null
|
||||
?string $city = null,
|
||||
): SearchApiQuery {
|
||||
$query = new SearchApiQuery();
|
||||
$query
|
||||
@@ -204,7 +204,7 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor
|
||||
}
|
||||
|
||||
if (null !== $gender) {
|
||||
$query->andWhereClause('person.gender = ?', [$gender]);
|
||||
$query->andWhereClause('person.gender_id = ?', [$gender]);
|
||||
}
|
||||
|
||||
return $query;
|
||||
@@ -255,10 +255,10 @@ final readonly class PersonACLAwareRepository implements PersonACLAwareRepositor
|
||||
?\DateTimeInterface $birthdate = null,
|
||||
?\DateTimeInterface $birthdateBefore = null,
|
||||
?\DateTimeInterface $birthdateAfter = null,
|
||||
?string $gender = null,
|
||||
?int $gender = null,
|
||||
?string $countryCode = null,
|
||||
?string $phonenumber = null,
|
||||
?string $city = null
|
||||
?string $city = null,
|
||||
): array {
|
||||
$query = $this->buildAuthorizedQuery(
|
||||
$default,
|
||||
|
||||
@@ -24,10 +24,10 @@ interface PersonACLAwareRepositoryInterface
|
||||
?\DateTimeInterface $birthdate = null,
|
||||
?\DateTimeInterface $birthdateBefore = null,
|
||||
?\DateTimeInterface $birthdateAfter = null,
|
||||
?string $gender = null,
|
||||
?int $gender = null,
|
||||
?string $countryCode = null,
|
||||
?string $phonenumber = null,
|
||||
?string $city = null
|
||||
?string $city = null,
|
||||
): SearchApiQuery;
|
||||
|
||||
public function countBySearchCriteria(
|
||||
@@ -37,10 +37,10 @@ interface PersonACLAwareRepositoryInterface
|
||||
?\DateTimeInterface $birthdate = null,
|
||||
?\DateTimeInterface $birthdateBefore = null,
|
||||
?\DateTimeInterface $birthdateAfter = null,
|
||||
?string $gender = null,
|
||||
?int $gender = null,
|
||||
?string $countryCode = null,
|
||||
?string $phonenumber = null,
|
||||
?string $city = null
|
||||
?string $city = null,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -56,10 +56,10 @@ interface PersonACLAwareRepositoryInterface
|
||||
?\DateTimeInterface $birthdate = null,
|
||||
?\DateTimeInterface $birthdateBefore = null,
|
||||
?\DateTimeInterface $birthdateAfter = null,
|
||||
?string $gender = null,
|
||||
?int $gender = null,
|
||||
?string $countryCode = null,
|
||||
?string $phonenumber = null,
|
||||
?string $city = null
|
||||
?string $city = null,
|
||||
): array;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\PersonAltName;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class PersonAltNameRepository
|
||||
final readonly class PersonAltNameRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -16,9 +16,9 @@ use Chill\PersonBundle\Entity\PersonNotDuplicate;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class PersonNotDuplicateRepository
|
||||
final readonly class PersonNotDuplicateRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ class PersonRepository implements ObjectRepository
|
||||
public function countByPhone(
|
||||
string $phonenumber,
|
||||
$centers,
|
||||
array $only = ['mobile', 'phone']
|
||||
array $only = ['mobile', 'phone'],
|
||||
): int {
|
||||
$qb = $this->repository->createQueryBuilder('p');
|
||||
$qb->select('COUNT(p)');
|
||||
@@ -83,7 +83,7 @@ class PersonRepository implements ObjectRepository
|
||||
$centers,
|
||||
$firstResult,
|
||||
$maxResults,
|
||||
array $only = ['mobile', 'phone']
|
||||
array $only = ['mobile', 'phone'],
|
||||
) {
|
||||
$qb = $this->repository->createQueryBuilder('p');
|
||||
$qb->select('p');
|
||||
|
||||
@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class PersonResourceRepository implements ObjectRepository
|
||||
final readonly class PersonResourceRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class EvaluationRepository implements EvaluationRepositoryInterface
|
||||
final readonly class EvaluationRepository implements EvaluationRepositoryInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class GoalRepository implements ObjectRepository
|
||||
final readonly class GoalRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -19,9 +19,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class ResultRepository implements ObjectRepository
|
||||
final readonly class ResultRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class SocialActionRepository implements ObjectRepository
|
||||
final readonly class SocialActionRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
@@ -44,6 +44,14 @@ final class SocialActionRepository implements ObjectRepository
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
public function findAllOrdered(): array
|
||||
{
|
||||
return $this->repository->createQueryBuilder('si')
|
||||
->orderBy('si.ordering', 'ASC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|SocialAction[]
|
||||
*/
|
||||
|
||||
@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class SocialIssueRepository implements ObjectRepository
|
||||
final readonly class SocialIssueRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
@@ -39,6 +39,14 @@ final class SocialIssueRepository implements ObjectRepository
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
public function findAllOrdered(): array
|
||||
{
|
||||
return $this->repository->createQueryBuilder('si')
|
||||
->orderBy('si.ordering', 'ASC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|SocialIssue[]
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user