mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge branch '111_exports_suite' into 111_export_GeographicalUnit
This commit is contained in:
@@ -27,6 +27,8 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterCurrent;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCurrentAddress;
|
||||
use Chill\PersonBundle\Entity\Person\PersonResource;
|
||||
use Chill\PersonBundle\Validator\Constraints\Household\HouseholdMembershipSequential;
|
||||
@@ -180,9 +182,21 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
* The person's center.
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
|
||||
* @deprecated
|
||||
*/
|
||||
private ?Center $center = null;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=PersonCenterHistory::class, mappedBy="person", cascade={"persist"})
|
||||
* @var Collection|PersonCenterHistory[]
|
||||
*/
|
||||
private Collection $centerHistory;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity=PersonCenterCurrent::class, mappedBy="person")
|
||||
*/
|
||||
private ?PersonCenterCurrent $centerCurrent = null;
|
||||
|
||||
/**
|
||||
* Array where customfield's data are stored.
|
||||
*
|
||||
@@ -523,6 +537,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
$this->budgetResources = new ArrayCollection();
|
||||
$this->budgetCharges = new ArrayCollection();
|
||||
$this->resources = new ArrayCollection();
|
||||
$this->centerHistory = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -895,9 +910,43 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $this->budgetResources;
|
||||
}
|
||||
|
||||
private function getCurrentCenterHistory(): ?PersonCenterHistory
|
||||
{
|
||||
if (0 === $this->centerHistory->count()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$criteria = Criteria::create();
|
||||
$now = new DateTimeImmutable('now');
|
||||
$criteria->where(Criteria::expr()->lte('startDate', $now))
|
||||
->andWhere(Criteria::expr()->orX(
|
||||
Criteria::expr()->isNull('endDate'),
|
||||
Criteria::expr()->gt('endDate', $now)
|
||||
));
|
||||
|
||||
$histories = $this->centerHistory->matching($criteria);
|
||||
|
||||
switch ($histories->count()) {
|
||||
case 0:
|
||||
return null;
|
||||
case 1:
|
||||
return $histories->first();
|
||||
default:
|
||||
throw new \UnexpectedValueException('It should not contains more than one center at a time');
|
||||
}
|
||||
}
|
||||
|
||||
public function getCenter(): ?Center
|
||||
{
|
||||
return $this->center;
|
||||
if (null !== $this->centerCurrent) {
|
||||
return $this->centerCurrent->getCenter();
|
||||
}
|
||||
|
||||
if (null === $currentCenterHistory = $this->getCurrentCenterHistory()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $currentCenterHistory->getCenter();
|
||||
}
|
||||
|
||||
public function getCFData(): ?array
|
||||
@@ -1510,17 +1559,67 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate the center with the person. The association start on 'now'.
|
||||
*
|
||||
* @param Center $center
|
||||
* @return $this
|
||||
*/
|
||||
public function setCenter(Center $center): self
|
||||
{
|
||||
$this->center = $center;
|
||||
|
||||
$modification = new DateTimeImmutable('now');
|
||||
|
||||
foreach ($this->centerHistory as $centerHistory) {
|
||||
if (null === $centerHistory->getEndDate()) {
|
||||
$centerHistory->setEndDate($modification);
|
||||
}
|
||||
}
|
||||
|
||||
$this->centerHistory[] = $new = new PersonCenterHistory($this, $center, $modification);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Report
|
||||
* @return Collection
|
||||
*/
|
||||
public function setCFData(?array $cFData)
|
||||
public function getCenterHistory(): Collection
|
||||
{
|
||||
return $this->centerHistory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $centerHistory
|
||||
* @return Person
|
||||
*/
|
||||
public function setCenterHistory(Collection $centerHistory): Person
|
||||
{
|
||||
$this->centerHistory = $centerHistory;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PersonCenterCurrent|null
|
||||
*/
|
||||
public function getCenterCurrent(): ?PersonCenterCurrent
|
||||
{
|
||||
if (null !== $this->centerCurrent) {
|
||||
return $this->centerCurrent;
|
||||
}
|
||||
|
||||
if (null === $currentCenterHistory = $this->getCurrentCenterHistory()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new PersonCenterCurrent($currentCenterHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person
|
||||
*/
|
||||
public function setCFData(?array $cFData): self
|
||||
{
|
||||
$this->cFData = $cFData;
|
||||
|
||||
|
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\Person;
|
||||
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Associate a Person with the current center.
|
||||
*
|
||||
* The process of selecting the current center is done on database side,
|
||||
* using a SQL view.
|
||||
*
|
||||
* @ORM\Entity(readOnly=true)
|
||||
* @ORM\Table(name="view_chill_person_person_center_history_current")
|
||||
* @psalm-internal Chill\PersonBundle\Entity
|
||||
*/
|
||||
class PersonCenterCurrent
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="centerCurrent")
|
||||
*/
|
||||
private Person $person;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Center::class)
|
||||
*/
|
||||
private Center $center;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=false)
|
||||
*/
|
||||
private \DateTimeImmutable $startDate;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||
*/
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
/**
|
||||
* Populate the properties person, center, start and end date from history.
|
||||
*
|
||||
* The creator and updatedby are not filled.
|
||||
*
|
||||
* @internal Should not be instantied, unless inside Person entity
|
||||
* @param PersonCenterHistory $history
|
||||
*/
|
||||
public function __construct(PersonCenterHistory $history)
|
||||
{
|
||||
$this->person = $history->getPerson();
|
||||
$this->center = $history->getCenter();
|
||||
$this->startDate = $history->getStartDate();
|
||||
$this->endDate = $history->getEndDate();
|
||||
$this->id = $history->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* The id will be the same as the current @link{PersonCenterHistory::class}
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person
|
||||
*/
|
||||
public function getPerson(): Person
|
||||
{
|
||||
return $this->person;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Center
|
||||
*/
|
||||
public function getCenter(): Center
|
||||
{
|
||||
return $this->center;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable
|
||||
*/
|
||||
public function getStartDate(): \DateTimeImmutable
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable|null
|
||||
*/
|
||||
public function getEndDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\Person;
|
||||
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Associate a Person with a Center. The association may change on date intervals
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="chill_person_person_center_history")
|
||||
*/
|
||||
class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
use TrackUpdateTrait;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="centerHistory")
|
||||
*/
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Center::class)
|
||||
*/
|
||||
private ?Center $center = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=false)
|
||||
*/
|
||||
private ?\DateTimeImmutable $startDate = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||
*/
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
/**
|
||||
* @param Person|null $person
|
||||
* @param Center|null $center
|
||||
* @param \DateTimeImmutable|null $startDate
|
||||
*/
|
||||
public function __construct(?Person $person = null, ?Center $center = null, ?\DateTimeImmutable $startDate = null)
|
||||
{
|
||||
$this->person = $person;
|
||||
$this->center = $center;
|
||||
$this->startDate = $startDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person|null
|
||||
*/
|
||||
public function getPerson(): ?Person
|
||||
{
|
||||
return $this->person;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Person|null $person
|
||||
*/
|
||||
public function setPerson(?Person $person): self
|
||||
{
|
||||
$this->person = $person;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Center|null
|
||||
*/
|
||||
public function getCenter(): ?Center
|
||||
{
|
||||
return $this->center;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Center|null $center
|
||||
*/
|
||||
public function setCenter(?Center $center): self
|
||||
{
|
||||
$this->center = $center;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable|null
|
||||
*/
|
||||
public function getStartDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTimeImmutable|null $startDate
|
||||
*/
|
||||
public function setStartDate(?\DateTimeImmutable $startDate): self
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeImmutable|null
|
||||
*/
|
||||
public function getEndDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTimeImmutable|null $endDate
|
||||
*/
|
||||
public function setEndDate(?\DateTimeImmutable $endDate): self
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -49,9 +49,8 @@ class Evaluation
|
||||
/**
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity=SocialAction::class,
|
||||
* inversedBy="evaluations"
|
||||
* mappedBy="evaluations"
|
||||
* )
|
||||
* @ORM\JoinTable(name="chill_person_social_work_evaluation_action")
|
||||
*/
|
||||
private Collection $socialActions;
|
||||
|
||||
|
@@ -25,23 +25,17 @@ class AbstractAccompanyingPeriodExportElement
|
||||
*/
|
||||
protected function addJoinAccompanyingPeriod(QueryBuilder $query): void
|
||||
{
|
||||
if (false === $this->havingAccompanyingPeriodInJoin($query)) {
|
||||
if (false === in_array('person', $query->getAllAliases(), true)) {
|
||||
throw new LogicException("the alias 'person' does not exists in "
|
||||
. 'query builder');
|
||||
}
|
||||
if (false === in_array('person', $query->getAllAliases(), true)) {
|
||||
throw new LogicException("the alias 'person' does not exists in "
|
||||
. 'query builder');
|
||||
}
|
||||
|
||||
$query->join('person.accompanyingPeriods', 'accompanying_period');
|
||||
if (!in_array('acppart', $query->getAllAliases(), true)) {
|
||||
$query->join('person.accompanyingPeriodParticipations', 'acppart');
|
||||
}
|
||||
|
||||
if (!in_array('acp', $query->getAllAliases(), true)) {
|
||||
$query->join('acppart.accompanyingPeriod', 'acp');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if "accompanying_period" alias is present in the query alises.
|
||||
*/
|
||||
protected function havingAccompanyingPeriodInJoin(QueryBuilder $query): bool
|
||||
{
|
||||
$joins = $query->getDQLPart('join') ?? [];
|
||||
|
||||
return in_array('accompanying_period', $query->getAllAliases(), true);
|
||||
}
|
||||
}
|
||||
|
@@ -40,18 +40,11 @@ class AdministrativeLocationAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acploc', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.administrativeLocation', 'acploc');
|
||||
$qb->leftJoin('acp.administrativeLocation', 'acploc');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acp.administrativeLocation) AS location_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('location_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('location_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('location_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -71,6 +64,10 @@ class AdministrativeLocationAggregator implements AggregatorInterface
|
||||
return 'Administrative location';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$l = $this->locationRepository->find($value);
|
||||
|
||||
return $l->getName() . ' (' . $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')';
|
||||
|
@@ -15,21 +15,23 @@ use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepositoryInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ClosingMotiveAggregator implements AggregatorInterface
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
private ClosingMotiveRepositoryInterface $motiveRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
ClosingMotiveRepositoryInterface $motiveRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->motiveRepository = $em->getRepository(ClosingMotive::class);
|
||||
$this->motiveRepository = $motiveRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
@@ -40,19 +42,8 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpmotive', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.closingMotive', 'acpmotive');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acp.closingMotive) AS closingmotive_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('closingmotive_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('closingmotive_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('closingmotive_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -72,6 +63,10 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
||||
return 'Closing motive';
|
||||
}
|
||||
|
||||
if (NULL === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$cm = $this->motiveRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@@ -35,14 +35,7 @@ class ConfidentialAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('acp.confidential AS confidential_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('confidential_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('confidential_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('confidential_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@@ -44,15 +44,8 @@ final class DurationAggregator implements AggregatorInterface
|
||||
// et ajouter une fonction custom qui calcule plus précisément les intervals, comme doctrineum/date-interval
|
||||
// https://packagist.org/packages/doctrineum/date-interval#3.1.0 (mais composer fait un conflit de dépendance)
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('duration_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('duration_aggregator');
|
||||
}
|
||||
|
||||
$qb->orderBy('duration_aggregator');
|
||||
$qb->addGroupBy('duration_aggregator');
|
||||
$qb->addOrderBy('duration_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@@ -35,14 +35,7 @@ class EmergencyAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('acp.emergency AS emergency_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('emergency_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('emergency_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('emergency_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@@ -41,22 +41,15 @@ final class EvaluationAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.works', 'acpw');
|
||||
$qb->leftJoin('acp.works', 'acpw');
|
||||
}
|
||||
|
||||
if (!in_array('workeval', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
||||
$qb->leftJoin('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(workeval.evaluation) AS evaluation_aggregator');
|
||||
|
||||
$groupby = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('evaluation_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('evaluation_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('evaluation_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -76,6 +69,10 @@ final class EvaluationAggregator implements AggregatorInterface
|
||||
return 'Evaluation';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$e = $this->evaluationRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@@ -35,14 +35,7 @@ class IntensityAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('acp.intensity AS intensity_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('intensity_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('intensity_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('intensity_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@@ -40,18 +40,11 @@ final class JobAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpjob', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.job', 'acpjob');
|
||||
$qb->leftJoin('acp.job', 'acpjob');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acp.job) AS job_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('job_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('job_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('job_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -71,6 +64,10 @@ final class JobAggregator implements AggregatorInterface
|
||||
return 'Job';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$j = $this->jobRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@@ -42,18 +42,11 @@ final class OriginAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acporigin', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.origin', 'acporigin');
|
||||
$qb->leftJoin('acp.origin', 'acporigin');
|
||||
}
|
||||
|
||||
$qb->addSelect('acporigin.id AS origin_aggregator');
|
||||
|
||||
$groupby = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('origin_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('origin_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('origin_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -73,6 +66,10 @@ final class OriginAggregator implements AggregatorInterface
|
||||
return 'Origin';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$o = $this->repository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@@ -40,18 +40,11 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpuser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.user', 'acpuser');
|
||||
$qb->leftJoin('acp.user', 'acpuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpuser.id AS referrer_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('referrer_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('referrer_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('referrer_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -71,6 +64,10 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
return 'Referrer';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$r = $this->userRepository->find($value);
|
||||
|
||||
return $this->userRender->renderString($r, []);
|
||||
|
@@ -57,15 +57,7 @@ final class RequestorAggregator implements AggregatorInterface
|
||||
END ) AS requestor_aggregator
|
||||
");
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('requestor_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('requestor_aggregator');
|
||||
}
|
||||
|
||||
// TODO 'order by' does not works !
|
||||
$qb->addGroupBy('requestor_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@@ -40,18 +40,11 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpscope', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.scopes', 'acpscope');
|
||||
$qb->leftJoin('acp.scopes', 'acpscope');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpscope.id as scope_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('scope_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('scope_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('scope_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -71,6 +64,10 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
return 'Scope';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$s = $this->scopeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@@ -41,18 +41,12 @@ final class SocialActionAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
||||
// here, we will only see accompanying period linked with a socialAction
|
||||
$qb->join('acp.works', 'acpw');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator'); // DISTINCT ??
|
||||
|
||||
$groupby = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('socialaction_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('socialaction_aggregator');
|
||||
}
|
||||
$qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator');
|
||||
$qb->addGroupBy('socialaction_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -72,6 +66,10 @@ final class SocialActionAggregator implements AggregatorInterface
|
||||
return 'Social action';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sa = $this->actionRepository->find($value);
|
||||
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
|
@@ -40,18 +40,12 @@ final class SocialIssueAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) {
|
||||
// we will see accompanying period linked with social issues
|
||||
$qb->join('acp.socialIssues', 'acpsocialissue');
|
||||
}
|
||||
|
||||
|
||||
$qb->addSelect('acpsocialissue.id as socialissue_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('socialissue_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('socialissue_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('socialissue_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@@ -41,15 +41,9 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('acp.step AS step_aggregator');
|
||||
$qb->addGroupBy('step_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('step_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('step_aggregator');
|
||||
}
|
||||
|
||||
/*
|
||||
// add date in where clause
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
@@ -69,6 +63,7 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE);
|
||||
*/
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@@ -39,15 +39,8 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('IDENTITY(eval.evaluation) AS evaluationtype_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('evaluationtype_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('evaluationtype_aggregator');
|
||||
}
|
||||
$qb->addSelect('IDENTITY(workeval.evaluation) AS eval_evaluationtype_aggregator');
|
||||
$qb->addGroupBy('eval_evaluationtype_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -67,6 +60,10 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
||||
return 'Evaluation type';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$ev = $this->evaluationRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize($ev->getTitle());
|
||||
@@ -75,7 +72,7 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['evaluationtype_aggregator'];
|
||||
return ['eval_evaluationtype_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@@ -39,39 +40,23 @@ class ChildrenNumberAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('composition', $qb->getAllAliases(), true)) {
|
||||
$qb->join('household.compositions', 'composition');
|
||||
if (!in_array('composition_children', $qb->getAllAliases(), true)) {
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lte('composition_children.startDate', ':ondate_composition_children'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->gt('composition_children.endDate', ':ondate_composition_children'),
|
||||
$qb->expr()->isNull('composition_children.endDate')
|
||||
)
|
||||
);
|
||||
|
||||
$qb->leftJoin('household.compositions', 'composition_children', Expr\Join::WITH, $clause);
|
||||
}
|
||||
|
||||
$qb->addSelect('composition.numberOfChildren AS childrennumber_aggregator');
|
||||
$qb
|
||||
->addSelect('composition_children.numberOfChildren AS childrennumber_aggregator')
|
||||
->addGroupBy('childrennumber_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('childrennumber_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('childrennumber_aggregator');
|
||||
}
|
||||
|
||||
// add date in where clause
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lte('composition.startDate', ':ondate'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->gt('composition.endDate', ':ondate'),
|
||||
$qb->expr()->isNull('composition.endDate')
|
||||
)
|
||||
);
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE);
|
||||
$qb->setParameter('ondate_composition_children', $data['on_date'], Types::DATE_MUTABLE);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -93,12 +78,11 @@ class ChildrenNumberAggregator implements AggregatorInterface
|
||||
return 'Number of children';
|
||||
}
|
||||
|
||||
return $this->translator->trans(
|
||||
'household_composition.numberOfChildren children in household',
|
||||
[
|
||||
'numberOfChildren' => $value,
|
||||
]
|
||||
);
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepository;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@@ -44,39 +45,23 @@ class CompositionAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('composition', $qb->getAllAliases(), true)) {
|
||||
$qb->join('household.compositions', 'composition');
|
||||
if (!in_array('composition_type', $qb->getAllAliases(), true)) {
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lte('composition_type.startDate', ':ondate_composition_type'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->gt('composition_type.endDate', ':ondate_composition_type'),
|
||||
$qb->expr()->isNull('composition_type.endDate')
|
||||
)
|
||||
);
|
||||
|
||||
$qb->leftJoin('household.compositions', 'composition_type', Expr\Join::WITH, $clause);
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(composition.householdCompositionType) AS composition_aggregator');
|
||||
$qb
|
||||
->addSelect('IDENTITY(composition_type.householdCompositionType) AS composition_aggregator')
|
||||
->addGroupBy('composition_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('composition_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('composition_aggregator');
|
||||
}
|
||||
|
||||
// add date in where clause
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lte('composition.startDate', ':ondate'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->gt('composition.endDate', ':ondate'),
|
||||
$qb->expr()->isNull('composition.endDate')
|
||||
)
|
||||
);
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE);
|
||||
$qb->setParameter('ondate_composition_type', $data['on_date'], Types::DATE_MUTABLE);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -98,6 +83,10 @@ class CompositionAggregator implements AggregatorInterface
|
||||
return 'Composition';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$c = $this->typeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@@ -62,6 +62,9 @@ final class GenderAggregator implements AggregatorInterface
|
||||
case Person::BOTH_GENDER:
|
||||
return $this->translator->trans('both');
|
||||
|
||||
case Person::NO_INFORMATION:
|
||||
return $this->translator->trans('unknown');
|
||||
|
||||
case null:
|
||||
return $this->translator->trans('Not given');
|
||||
|
||||
|
@@ -59,6 +59,7 @@ final class MaritalStatusAggregator implements AggregatorInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
|
@@ -40,18 +40,11 @@ final class ActionTypeAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwsocialaction', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.socialAction', 'acpwsocialaction');
|
||||
$qb->leftJoin('acpw.socialAction', 'acpwsocialaction');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpwsocialaction.id as action_type_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('action_type_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('action_type_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('action_type_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
@@ -71,6 +64,10 @@ final class ActionTypeAggregator implements AggregatorInterface
|
||||
return 'Social Action Type';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sa = $this->socialActionRepository->find($value);
|
||||
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
|
@@ -38,21 +38,14 @@ final class GoalAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.goals', 'goal');
|
||||
$qb->leftJoin('acpw.goals', 'goal');
|
||||
}
|
||||
|
||||
$qb->addSelect('goal.id as goal_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('goal_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('goal_aggregator');
|
||||
}
|
||||
$qb->addSelect('IDENTITY(goal.goal) as acpw_goal_aggregator');
|
||||
$qb->addGroupBy('acpw_goal_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
||||
}
|
||||
@@ -69,18 +62,24 @@ final class GoalAggregator implements AggregatorInterface
|
||||
return 'Goal Type';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$g = $this->goalRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize($g->getTitle());
|
||||
return $this->translatableStringHelper->localize(
|
||||
$g->getTitle()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['goal_aggregator'];
|
||||
return ['acpw_goal_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group social work actions by goal';
|
||||
}
|
||||
|
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
||||
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class GoalResultAggregator implements AggregatorInterface
|
||||
{
|
||||
private ResultRepository $resultRepository;
|
||||
|
||||
private GoalRepository $goalRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ResultRepository $resultRepository,
|
||||
GoalRepository $goalRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->resultRepository = $resultRepository;
|
||||
$this->goalRepository = $goalRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value) use ($key): string {
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
switch ($key) {
|
||||
case 'goal_aggregator':
|
||||
|
||||
if ('_header' === $value) {
|
||||
return 'Goal Type';
|
||||
}
|
||||
|
||||
$g = $this->goalRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
$g->getTitle()
|
||||
);
|
||||
|
||||
case 'result_aggregator':
|
||||
|
||||
if ('_header' === $value) {
|
||||
return 'Result Type';
|
||||
}
|
||||
|
||||
$r = $this->resultRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
$r->getTitle()
|
||||
);
|
||||
|
||||
default:
|
||||
throw new \LogicException();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return [
|
||||
'goal_aggregator',
|
||||
'result_aggregator'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group social work actions by goal and result';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('acpw.goals', 'goal');
|
||||
}
|
||||
|
||||
if (!in_array('goalresult', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('goal.results', 'goalresult');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(goal.goal) as goal_aggregator');
|
||||
$qb->addSelect('goalresult.id as result_aggregator');
|
||||
$qb->addGroupBy('goal_aggregator')->addGroupBy('result_aggregator');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
||||
}
|
||||
}
|
@@ -40,18 +40,11 @@ final class JobAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.referrers', 'acpwuser');
|
||||
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acpwuser.userJob) as job_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('job_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('job_aggregator');
|
||||
}
|
||||
$qb->addSelect('IDENTITY(acpwuser.userJob) as job_aggregator')
|
||||
->addGroupBy('job_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -71,6 +64,10 @@ final class JobAggregator implements AggregatorInterface
|
||||
return 'Job';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$j = $this->jobRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@@ -40,18 +40,11 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.referrers', 'acpwuser');
|
||||
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpwuser.id AS referrer_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('referrer_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('referrer_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('referrer_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -71,6 +64,10 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
return 'Referrer';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$r = $this->userRepository->find($value);
|
||||
|
||||
return $this->userRender->renderString($r, []);
|
||||
|
@@ -37,30 +37,15 @@ final class ResultAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwresult', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.results', 'acpwresult');
|
||||
if (!in_array('result', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('acpw.results', 'result');
|
||||
}
|
||||
|
||||
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.goals', 'goal');
|
||||
}
|
||||
|
||||
if (!in_array('goalresult', $qb->getAllAliases(), true)) {
|
||||
$qb->join('goal.results', 'goalresult');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpwresult.id, IDENTITY(goal.results) as result_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('result_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('result_aggregator');
|
||||
}
|
||||
$qb->addSelect('result.id AS acpw_result_aggregator');
|
||||
$qb->addGroupBy('acpw_result_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
||||
}
|
||||
@@ -77,18 +62,24 @@ final class ResultAggregator implements AggregatorInterface
|
||||
return 'Result Type';
|
||||
}
|
||||
|
||||
$g = $this->resultRepository->find($value);
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->translatableStringHelper->localize($g->getTitle());
|
||||
$r = $this->resultRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
$r->getTitle()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['result_aggregator'];
|
||||
return ['acpw_result_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group social work actions by result';
|
||||
}
|
||||
|
@@ -40,18 +40,11 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.referrers', 'acpwuser');
|
||||
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acpwuser.mainScope) as scope_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('scope_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('scope_aggregator');
|
||||
}
|
||||
$qb->addGroupBy('scope_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -71,6 +64,10 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
return 'Scope';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$s = $this->scopeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@@ -15,6 +15,8 @@ use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -90,9 +92,25 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||
{
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
$qb = $this->repository->createQueryBuilder('acp');
|
||||
|
||||
$qb->select('COUNT(acp.id) AS export_result');
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
)
|
||||
->setParameter('authorized_centers', $centers)
|
||||
;
|
||||
|
||||
$qb->select('COUNT(DISTINCT acp.id) AS export_result');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -15,6 +15,8 @@ use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -88,6 +90,10 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
$qb = $this->repository->createQueryBuilder('acp');
|
||||
|
||||
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
||||
@@ -98,7 +104,19 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
|
||||
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
||||
}
|
||||
|
||||
$qb->select('COUNT(workeval.id) AS export_result');
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
)
|
||||
->setParameter('authorized_centers', $centers)
|
||||
;
|
||||
|
||||
$qb->select('COUNT(DISTINCT workeval.id) AS export_result');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -15,6 +15,9 @@ use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -88,26 +91,31 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('acp');
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
if (!in_array('acppart', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.participations', 'acppart');
|
||||
}
|
||||
$qb = $this->repository
|
||||
->createQueryBuilder('acp')
|
||||
->join('acp.participations', 'acppart')
|
||||
// little optimization: we remove joins and make a direct join between participations and household members
|
||||
->join(HouseholdMember::class, 'member', Query\Expr\Join::WITH, 'IDENTITY(acppart.person) = IDENTITY(member.person)')
|
||||
->join('member.household', 'household')
|
||||
;
|
||||
|
||||
if (!in_array('partperson', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acppart.person', 'partperson');
|
||||
}
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
)
|
||||
->setParameter('authorized_centers', $centers)
|
||||
;
|
||||
|
||||
if (!in_array('member', $qb->getAllAliases(), true)) {
|
||||
$qb->join('partperson.householdParticipations', 'member');
|
||||
}
|
||||
|
||||
if (!in_array('household', $qb->getAllAliases(), true)) {
|
||||
$qb->join('member.household', 'household');
|
||||
}
|
||||
|
||||
|
||||
$qb->select('COUNT(DISTINCT member.household) AS export_result');
|
||||
$qb->select('COUNT(DISTINCT household.id) AS export_result');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -14,9 +14,11 @@ namespace Chill\PersonBundle\Export\Export;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use LogicException;
|
||||
@@ -100,9 +102,12 @@ class CountPerson implements ExportInterface, GroupedExportInterface
|
||||
$qb = $this->personRepository->createQueryBuilder('person');
|
||||
|
||||
$qb->select('COUNT(person.id) AS export_result')
|
||||
->join('person.center', 'center')
|
||||
->andWhere('center IN (:authorized_centers)')
|
||||
->setParameter('authorized_centers', $centers);
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
|
||||
)
|
||||
)
|
||||
->setParameter('authorized_centers', $centers);
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -88,6 +89,10 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
$qb = $this->repository->createQueryBuilder('acp');
|
||||
|
||||
if (!in_array('acppart', $qb->getAllAliases(), true)) {
|
||||
@@ -95,10 +100,16 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
|
||||
}
|
||||
|
||||
if (!in_array('partperson', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acppart.person', 'partperson');
|
||||
$qb->join('acppart.person', 'person');
|
||||
}
|
||||
|
||||
$qb->select('COUNT(DISTINCT partperson.id) AS export_result');
|
||||
$qb->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM '.PersonCenterHistory::class.' pch WHERE pch.person = person.id AND pch.center IN (:authorized_centers)'
|
||||
)
|
||||
)->setParameter('authorized_centers', $centers);
|
||||
|
||||
$qb->select('COUNT(DISTINCT person.id) AS export_result');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -15,6 +15,8 @@ use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -90,13 +92,26 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('acp');
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.works', 'acpw');
|
||||
}
|
||||
$qb = $this->repository->createQueryBuilder('acp')
|
||||
->join('acp.works', 'acpw');
|
||||
|
||||
$qb->select('COUNT(acpw.id) as export_result');
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
)
|
||||
->setParameter('authorized_centers', $centers)
|
||||
;
|
||||
|
||||
$qb->select('COUNT(DISTINCT acpw.id) as export_result');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@ use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use DateTime;
|
||||
@@ -94,15 +96,27 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||
{
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
$qb = $this->repository->createQueryBuilder('acp');
|
||||
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
)
|
||||
->setParameter('authorized_centers', $centers)
|
||||
;
|
||||
|
||||
$qb
|
||||
->select('AVG(
|
||||
( CASE
|
||||
WHEN acp.closingDate IS NOT NULL
|
||||
THEN acp.closingDate
|
||||
ELSE :force_closingDate
|
||||
END ) - acp.openingDate
|
||||
COALESCE(acp.closingDate, :force_closingDate) - acp.openingDate
|
||||
) AS export_result')
|
||||
->setParameter('force_closingDate', $data['closingdate']);
|
||||
|
||||
|
@@ -29,24 +29,9 @@ class ActiveOneDayBetweenDatesFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = "OVERLAPSI (acp.openingDate, acp.closingDate), (:datefrom, :dateto) = 'TRUE'";
|
||||
|
||||
$clause = $qb->expr()->orX(
|
||||
$qb->expr()->lt('(acp.openingDate + 1)', ':dateto'),
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lt('acp.openingDate', ':datefrom'),
|
||||
$qb->expr()->isNull('acp.closingDate')
|
||||
),
|
||||
$qb->expr()->gt('(acp.closingDate - 1)', ':datefrom')
|
||||
);
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->andWhere($clause);
|
||||
$qb->setParameter('datefrom', $data['date_from'], Types::DATE_MUTABLE);
|
||||
$qb->setParameter('dateto', $data['date_to'], Types::DATE_MUTABLE);
|
||||
}
|
||||
|
@@ -29,20 +29,12 @@ class OpenBetweenDatesFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lt('acp.openingDate', ':datefrom'),
|
||||
$qb->expr()->gt('acp.closingDate', ':dateto')
|
||||
$qb->expr()->gte('acp.openingDate', ':datefrom'),
|
||||
$qb->expr()->lte('acp.openingDate', ':dateto')
|
||||
);
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->andWhere($clause);
|
||||
$qb->setParameter('datefrom', $data['date_from'], Types::DATE_MUTABLE);
|
||||
$qb->setParameter('dateto', $data['date_to'], Types::DATE_MUTABLE);
|
||||
}
|
||||
|
@@ -70,10 +70,6 @@ final class RequestorFilter implements FilterInterface
|
||||
case 'other_person':
|
||||
$expr = $this->em->getExpressionBuilder();
|
||||
|
||||
if (!in_array('acppart', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.participations', 'acppart');
|
||||
}
|
||||
|
||||
$clause = $expr->andX(
|
||||
$expr->isNotNull('acp.requestorPerson'),
|
||||
$expr->notIn(
|
||||
@@ -85,6 +81,7 @@ final class RequestorFilter implements FilterInterface
|
||||
->join('acp2.participations', 'acppart2')
|
||||
->select('identity(acp2.requestorPerson)')
|
||||
->where($expr->eq('acp2.requestorPerson', 'acppart2.person'))
|
||||
->andWhere('acp2.id = acp.id')
|
||||
->getDQL()
|
||||
)
|
||||
);
|
||||
|
@@ -18,6 +18,7 @@ use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
@@ -41,32 +42,24 @@ class CompositionFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('composition', $qb->getAllAliases(), true)) {
|
||||
$qb->join('household.compositions', 'composition');
|
||||
if (!in_array('composition_type_filter', $qb->getAllAliases(), true)) {
|
||||
$clause =
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte('composition_type_filter.startDate', ':ondate_composition_type_filter'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->gt('composition_type_filter.endDate', ':ondate_composition_type_filter'),
|
||||
$qb->expr()->isNull('composition_type_filter.endDate')
|
||||
)
|
||||
);
|
||||
|
||||
$qb->join('household.compositions', 'composition', Expr\Join::WITH, $clause);
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$whereClause = $qb->expr()->in('composition_type_filter.householdCompositionType', ':compositions');
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->in('composition.householdCompositionType', ':compositions'),
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte('composition.startDate', ':ondate'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->gt('composition.endDate', ':ondate'),
|
||||
$qb->expr()->isNull('composition.endDate')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->andWhere($whereClause);
|
||||
$qb->setParameter('compositions', $data['accepted_composition']);
|
||||
$qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE);
|
||||
$qb->setParameter('ondate_composition_type_filter', $data['on_date'], Types::DATE_MUTABLE);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@@ -32,8 +32,8 @@ class AccompanyingPeriodClosingFilter extends AbstractAccompanyingPeriodExportEl
|
||||
$this->addJoinAccompanyingPeriod($qb);
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lte('accompanying_period.closingDate', ':date_to'),
|
||||
$qb->expr()->gte('accompanying_period.closingDate', ':date_from')
|
||||
$qb->expr()->lte('acp.closingDate', ':date_to'),
|
||||
$qb->expr()->gte('acp.closingDate', ':date_from')
|
||||
);
|
||||
|
||||
$qb->andWhere($clause);
|
||||
|
@@ -34,12 +34,12 @@ class AccompanyingPeriodFilter extends AbstractAccompanyingPeriodExportElement i
|
||||
$clause = $qb->expr()->andX();
|
||||
|
||||
$clause->add(
|
||||
$qb->expr()->lte('accompanying_period.openingDate', ':date_to')
|
||||
$qb->expr()->lte('acp.openingDate', ':date_to')
|
||||
);
|
||||
$clause->add(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->gte('accompanying_period.closingDate', ':date_from'),
|
||||
$qb->expr()->isNull('accompanying_period.closingDate')
|
||||
$qb->expr()->gte('acp.closingDate', ':date_from'),
|
||||
$qb->expr()->isNull('acp.closingDate')
|
||||
)
|
||||
);
|
||||
|
||||
|
@@ -32,8 +32,8 @@ class AccompanyingPeriodOpeningFilter extends AbstractAccompanyingPeriodExportEl
|
||||
$this->addJoinAccompanyingPeriod($qb);
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lte('accompanying_period.openingDate', ':date_to'),
|
||||
$qb->expr()->gte('accompanying_period.openingDate', ':date_from')
|
||||
$qb->expr()->lte('acp.openingDate', ':date_to'),
|
||||
$qb->expr()->gte('acp.openingDate', ':date_from')
|
||||
);
|
||||
|
||||
$qb->andWhere($clause);
|
||||
|
@@ -34,17 +34,20 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$min = null !== $data['min_age'] ? $data['min_age'] : 0;
|
||||
$max = null !== $data['max_age'] ? $data['max_age'] : 200;
|
||||
$max = null !== $data['max_age'] ? $data['max_age'] : 3000;
|
||||
$calc = $data['date_calc'];
|
||||
|
||||
$minDate = $calc->sub(new \DateInterval('P' . $max . 'Y'));
|
||||
$maxDate = $calc->sub(new \DateInterval('P' . $min . 'Y'));
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->gte(
|
||||
'DATE_DIFF(:calc_date, person.birthdate)/365',
|
||||
':min_age'
|
||||
'person.birthdate',
|
||||
':min_date'
|
||||
),
|
||||
$qb->expr()->lte(
|
||||
'DATE_DIFF(:calc_date, person.birthdate)/365',
|
||||
':max_age'
|
||||
'person.birthdate',
|
||||
':max_date'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -55,9 +58,8 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('min_age', $min);
|
||||
$qb->setParameter('max_age', $max);
|
||||
$qb->setParameter('calc_date', $calc);
|
||||
$qb->setParameter('min_date', $minDate);
|
||||
$qb->setParameter('max_date', $maxDate);
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
@@ -77,7 +79,8 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
|
||||
$builder->add('date_calc', ChillDateType::class, [
|
||||
'label' => 'Calculate age in relation to this date',
|
||||
'data' => new DateTime('now'),
|
||||
'data' => new \DateTimeImmutable('now'),
|
||||
'input' => 'datetime_immutable'
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -56,10 +56,17 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->isNotNull('resaddr.hostThirdParty'),
|
||||
$qb->expr()->between(':date', 'resaddr.startDate', 'resaddr.endDate'),
|
||||
$qb->expr()->in('tpartycat.id', ':type')
|
||||
$qb->expr()->in('tpartycat.id', ':type'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->between(':date', 'resaddr.startDate', 'resaddr.endDate'),
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte('resaddr.startDate', ':date'),
|
||||
$qb->expr()->isNull('resaddr.endDate')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ($where instanceof Expr\Andx) {
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\PersonBundle\Entity\Person\ResidentialAddress;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
@@ -36,7 +37,17 @@ class ResidentialAddressAtUserFilter implements FilterInterface
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->isNotNull('resaddr.hostPerson');
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->isNotNull('resaddr.hostPerson'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->between(':date', 'resaddr.startDate', 'resaddr.endDate'),
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte('resaddr.startDate', ':date'),
|
||||
$qb->expr()->isNull('resaddr.endDate')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
@@ -44,6 +55,7 @@ class ResidentialAddressAtUserFilter implements FilterInterface
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->setParameter('date', $data['date_calc']);
|
||||
$qb->add('where', $where);
|
||||
}
|
||||
|
||||
@@ -54,7 +66,10 @@ class ResidentialAddressAtUserFilter implements FilterInterface
|
||||
|
||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
|
||||
{
|
||||
// No form needed unless validity date should be added ( not specified in doc as a parameter ).
|
||||
$builder->add('date_calc', ChillDateType::class, [
|
||||
'label' => 'Date during which residential address was valid',
|
||||
'data' => new \DateTime('now'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@@ -40,6 +41,10 @@ class EvaluationType extends AbstractType
|
||||
->add('title', TranslatableStringFormType::class, [
|
||||
'label' => 'Nom',
|
||||
])
|
||||
->add('url', UrlType::class, [
|
||||
'label' => 'evaluation.url',
|
||||
'required' => false,
|
||||
])
|
||||
->add('delay', DateIntervalType::class, [
|
||||
'label' => 'evaluation.delay',
|
||||
'required' => false,
|
||||
|
@@ -15,8 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use UnexpectedValueException;
|
||||
|
||||
final class ClosingMotiveRepository
|
||||
final class ClosingMotiveRepository implements ClosingMotiveRepositoryInterface
|
||||
{
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
@@ -54,4 +55,35 @@ final class ClosingMotiveRepository
|
||||
->createNativeQuery($sql, $rsm)
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function find($id): ?ClosingMotive
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|ClosingMotive[]
|
||||
*/
|
||||
public function findAll(): array
|
||||
{
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|ClosingMotive[]
|
||||
*/
|
||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||
{
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?ClosingMotive
|
||||
{
|
||||
return $this->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
{
|
||||
return ClosingMotive::class;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
|
||||
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
interface ClosingMotiveRepositoryInterface extends ObjectRepository
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getActiveClosingMotive(bool $onlyLeaf = true);
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Repository\Person;
|
||||
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
interface PersonCenterHistoryInterface extends ObjectRepository
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Repository\Person;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class PersonCenterHistoryRepository implements PersonCenterHistoryInterface
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->repository = $em->getRepository($this->getClassName());
|
||||
}
|
||||
|
||||
public function find($id): ?PersonCenterHistory
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|PersonCenterHistory[]
|
||||
*/
|
||||
public function findAll(): array
|
||||
{
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|PersonCenterHistory[]
|
||||
*/
|
||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||
{
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?PersonCenterHistory
|
||||
{
|
||||
return $this->repository->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
{
|
||||
return PersonCenterHistory::class;
|
||||
}
|
||||
}
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Repository\CountryRepository;
|
||||
use Chill\MainBundle\Search\ParsingException;
|
||||
use Chill\MainBundle\Search\SearchApiQuery;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use DateTimeInterface;
|
||||
@@ -34,7 +35,7 @@ use function implode;
|
||||
|
||||
final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterface
|
||||
{
|
||||
private AuthorizationHelper $authorizationHelper;
|
||||
private AuthorizationHelperInterface $authorizationHelper;
|
||||
|
||||
private CountryRepository $countryRepository;
|
||||
|
||||
@@ -46,7 +47,7 @@ final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterfac
|
||||
Security $security,
|
||||
EntityManagerInterface $em,
|
||||
CountryRepository $countryRepository,
|
||||
AuthorizationHelper $authorizationHelper
|
||||
AuthorizationHelperInterface $authorizationHelper
|
||||
) {
|
||||
$this->security = $security;
|
||||
$this->em = $em;
|
||||
@@ -310,9 +311,10 @@ final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterfac
|
||||
}
|
||||
|
||||
return $query
|
||||
->setFromClause($query->getFromClause() . ' JOIN view_chill_person_person_center_history_current vcppchc ON vcppchc.person_id = person.id', $query->getFromParams())
|
||||
->andWhereClause(
|
||||
strtr(
|
||||
'person.center_id IN ({{ center_ids }})',
|
||||
'vcppchc.center_id IN ({{ center_ids }})',
|
||||
[
|
||||
'{{ center_ids }}' => implode(
|
||||
', ',
|
||||
|
@@ -180,7 +180,7 @@
|
||||
{% if members|length > 0 %}
|
||||
<div class="flex-table list-household-members">
|
||||
{% for m in members %}
|
||||
{% if m.position.shareHousehold %}
|
||||
{% if m.position is null or m.position.shareHousehold %}
|
||||
{% include '@ChillPerson/Household/_render_member.html.twig' with {
|
||||
'member': m,
|
||||
'customButtons': { 'before': _self.customButtons(m, household) }
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
@@ -191,4 +192,29 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertEquals($r['result'], Person::ERROR_ADDIND_PERIOD_AFTER_AN_OPEN_PERIOD);
|
||||
}
|
||||
|
||||
public function testSetCenter()
|
||||
{
|
||||
$person = new Person();
|
||||
$centerA = new Center();
|
||||
$centerB = new Center();
|
||||
|
||||
$this->assertCount(0, $person->getCenterHistory());
|
||||
$this->assertNull($person->getCenter());
|
||||
$this->assertNull($person->getCenterCurrent());
|
||||
|
||||
$person->setCenter($centerA);
|
||||
|
||||
$this->assertCount(1, $person->getCenterHistory());
|
||||
$this->assertSame($centerA, $person->getCenter());
|
||||
$this->assertInstanceOf(Person\PersonCenterCurrent::class, $person->getCenterCurrent());
|
||||
$this->assertSame($centerA, $person->getCenterCurrent()->getCenter());
|
||||
|
||||
$person->setCenter($centerB);
|
||||
|
||||
$this->assertCount(2, $person->getCenterHistory());
|
||||
$this->assertSame($centerB, $person->getCenter());
|
||||
$this->assertInstanceOf(Person\PersonCenterCurrent::class, $person->getCenterCurrent());
|
||||
$this->assertSame($centerB, $person->getCenterCurrent()->getCenter());
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\AdministrativeLocationAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class AdministrativeLocationAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private AdministrativeLocationAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_administrative_location');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.administrativeLocation', 'acploc')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ClosingMotiveAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class ClosingMotiveAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private ClosingMotiveAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_closingmotive');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.closingMotive', 'acpmotive')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ConfidentialAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class ConfidentialAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private ConfidentialAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_confidential');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\DurationAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class DurationAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private DurationAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_duration');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\EmergencyAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class EmergencyAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private EmergencyAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_emergency');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\EvaluationAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class EvaluationAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private EvaluationAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_evaluation');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\IntensityAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class IntensityAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private IntensityAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_intensity');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\JobAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private JobAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_referrer_job');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.job', 'acpjob')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\OriginAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class OriginAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private OriginAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_origin');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.origin', 'acporigin')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ReferrerAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private ReferrerAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_referrer');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.user', 'acpuser')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\RequestorAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class RequestorAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private RequestorAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_requestor');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.participations', 'acppart')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ScopeAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private ScopeAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_referrer_scope');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.scopes', 'acpscope')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialActionAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class SocialActionAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private SocialActionAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_socialaction');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialIssueAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class SocialIssueAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private SocialIssueAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_socialissue');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.socialIssues', 'acpsocialissue')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\StepAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class StepAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private StepAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_step');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'on_date' => \DateTime::createFromFormat('Y-m-d', '2022-01-01'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\EvaluationAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\EvaluationAggregators\EvaluationTypeAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class EvaluationTypeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private EvaluationTypeAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_evaluationtype');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\HouseholdAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\ChildrenNumberAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class ChildrenNumberAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private ChildrenNumberAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_household_childrennumber');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'on_date' => \DateTime::createFromFormat('Y-m-d', '2022-07-01')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.participations', 'acppart')
|
||||
->join('acppart.person', 'partperson')
|
||||
->join('partperson.householdParticipations', 'member')
|
||||
->join('member.household', 'household')
|
||||
->join('household.compositions', 'composition')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\HouseholdAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\CompositionAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class CompositionAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private CompositionAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_household_composition');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'on_date' => \DateTime::createFromFormat('Y-m-d', '2022-07-01')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.participations', 'acppart')
|
||||
->join('acppart.person', 'partperson')
|
||||
->join('partperson.householdParticipations', 'member')
|
||||
->join('member.household', 'household')
|
||||
->join('household.compositions', 'composition')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\AgeAggregator;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
@@ -20,10 +21,7 @@ use DateTime;
|
||||
*/
|
||||
final class AgeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
/**
|
||||
* @var \Chill\PersonBundle\Export\Aggregator\PersonAggregators\AgeAggregator
|
||||
*/
|
||||
private $aggregator;
|
||||
private AgeAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\CountryOfBirthAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class CountryOfBirthAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private CountryOfBirthAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_country_of_birth');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
['group_by_level' => 'continent'],
|
||||
['group_by_level' => 'country',],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from(Person::class, 'person')
|
||||
->leftJoin('person.countryOfBirth', 'countryOfBirth')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\GenderAggregator;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -19,10 +20,7 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
*/
|
||||
final class GenderAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
/**
|
||||
* @var \Chill\PersonBundle\Export\Aggregator\PersonAggregators\GenderAggregator
|
||||
*/
|
||||
private $aggregator;
|
||||
private GenderAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\HouseholdPositionAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
|
||||
final class HouseholdPositionAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private HouseholdPositionAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_household_position');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_position' => \DateTime::createFromFormat('Y-m-d', '2022-07-01')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from(Person::class, 'person')
|
||||
->join(HouseholdMember::class, 'householdmember', Expr\Join::WITH, 'householdmember.person = person')
|
||||
->join('person.center', 'center')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\MaritalStatusAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class MaritalStatusAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private MaritalStatusAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_marital_status');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from(Person::class, 'person')
|
||||
->join('person.maritalStatus', 'personmarital')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\NationalityAggregator;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -19,10 +20,7 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
*/
|
||||
final class NationalityAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
/**
|
||||
* @var \Chill\PersonBundle\Export\Aggregator\PersonAggregators\NationalityAggregator
|
||||
*/
|
||||
private $aggregator;
|
||||
private NationalityAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator;
|
||||
|
||||
/**
|
||||
@@ -34,14 +35,14 @@ final class ActionTypeAggregatorTest extends AbstractAggregatorTest
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
@@ -53,7 +54,8 @@ final class ActionTypeAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acpw.id)')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
->from(AccompanyingPeriodWork::class, 'acpw')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalAggregator;
|
||||
|
||||
/**
|
||||
@@ -34,14 +35,14 @@ final class GoalAggregatorTest extends AbstractAggregatorTest
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
@@ -53,7 +54,8 @@ final class GoalAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acpw.id)')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
->from(AccompanyingPeriodWork::class, 'acpw')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalResultAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class GoalResultAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private GoalResultAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_goalresult');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.goals', 'goal')
|
||||
->join('goal.results', 'goalresult')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\JobAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private JobAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_treatingagent_job');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.referrers', 'acpwuser')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator;
|
||||
|
||||
/**
|
||||
@@ -34,14 +35,14 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
@@ -53,7 +54,8 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acpw.id)')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
->from(AccompanyingPeriodWork::class, 'acpw')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ResultAggregator;
|
||||
|
||||
/**
|
||||
@@ -34,14 +35,14 @@ final class ResultAggregatorTest extends AbstractAggregatorTest
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
@@ -53,7 +54,8 @@ final class ResultAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acpw.id)')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
->from(AccompanyingPeriodWork::class, 'acpw')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ScopeAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private ScopeAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_treatingagent_scope');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.referrers', 'acpwuser')
|
||||
,
|
||||
];
|
||||
}
|
||||
}
|
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\UserJobFilter;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\CurrentUserJobFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
*/
|
||||
final class CurrentUserJobFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private UserJobFilter $filter;
|
||||
private CurrentUserJobFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\UserScopeFilter;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\CurrentUserScopeFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
*/
|
||||
final class CurrentUserScopeFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private UserScopeFilter $filter;
|
||||
private CurrentUserScopeFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\EvaluationFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||
use Chill\PersonBundle\Export\Filter\EvaluationFilters\EvaluationTypeFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class EvaluationTypeFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private EvaluationTypeFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$request = $this->prophesize();
|
||||
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_evaluationtype');
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(Evaluation::class, 'e')
|
||||
->select('e')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($array as $r) {
|
||||
$data[] = [
|
||||
'accepted_evaluationtype' => $r
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('workeval.id')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\EvaluationFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||
use Chill\PersonBundle\Export\Filter\EvaluationFilters\MaxDateFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class MaxDateFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private MaxDateFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$request = $this->prophesize();
|
||||
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_maxdate');
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
['maxdate' => false ],
|
||||
['maxdate' => true ]
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('workeval.id')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\HouseholdFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
|
||||
use Chill\PersonBundle\Export\Filter\HouseholdFilters\CompositionFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CompositionFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private CompositionFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$request = $this->prophesize();
|
||||
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_household_composition');
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(HouseholdCompositionType::class, 'r')
|
||||
->select('r')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($array as $r) {
|
||||
$data[] = [
|
||||
'accepted_composition' => $r,
|
||||
'on_date' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('h.id')
|
||||
->from(Household::class, 'h'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\AccompanyingPeriodClosingFilter;
|
||||
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingPeriodClosingFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private AccompanyingPeriodClosingFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
try {
|
||||
$this->filter = self::$container->get('chill.person.export.filter_accompanying_period_closing');
|
||||
} catch (ServiceNotFoundException $e) {
|
||||
$this->markTestSkipped('The current configuration does not use accompanying_periods');
|
||||
}
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2000-01-01'),
|
||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2010-01-01'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('person.firstName')
|
||||
->from('ChillPersonBundle:Person', 'person'),
|
||||
$em->createQueryBuilder()
|
||||
->select('person.firstName')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
// add a dummy where clause
|
||||
->where('person.firstname IS NOT NULL'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(IDENTITY(p))')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
// add a dummy where clause
|
||||
->where('person.firstname IS NOT NULL'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(IDENTITY(p))')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
->join('person.accompanyingPeriods', 'accompanying_period')
|
||||
// add a dummy where clause
|
||||
->where('person.firstname IS NOT NULL'),
|
||||
$em->createQueryBuilder()
|
||||
->select('activity.date AS date')
|
||||
->select('activity.attendee as attendee')
|
||||
->from('ChillActivityBundle:Activity', 'activity')
|
||||
->join('activity.person', 'person')
|
||||
->join('person.center', 'center'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\BirthdateFilter;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\AccompanyingPeriodFilter;
|
||||
use DateTime;
|
||||
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
|
||||
@@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
*/
|
||||
final class AccompanyingPeriodFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private BirthdateFilter $filter;
|
||||
private AccompanyingPeriodFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\AccompanyingPeriodOpeningFilter;
|
||||
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingPeriodOpeningFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private AccompanyingPeriodOpeningFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
try {
|
||||
$this->filter = self::$container->get('chill.person.export.filter_accompanying_period_opening');
|
||||
} catch (ServiceNotFoundException $e) {
|
||||
$this->markTestSkipped('The current configuration does not use accompanying_periods');
|
||||
}
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2000-01-01'),
|
||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2010-01-01'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('person.firstName')
|
||||
->from('ChillPersonBundle:Person', 'person'),
|
||||
$em->createQueryBuilder()
|
||||
->select('person.firstName')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
// add a dummy where clause
|
||||
->where('person.firstname IS NOT NULL'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(IDENTITY(p))')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
// add a dummy where clause
|
||||
->where('person.firstname IS NOT NULL'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(IDENTITY(p))')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
->join('person.accompanyingPeriods', 'accompanying_period')
|
||||
// add a dummy where clause
|
||||
->where('person.firstname IS NOT NULL'),
|
||||
$em->createQueryBuilder()
|
||||
->select('activity.date AS date')
|
||||
->select('activity.attendee as attendee')
|
||||
->from('ChillActivityBundle:Activity', 'activity')
|
||||
->join('activity.person', 'person')
|
||||
->join('person.center', 'center'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\AgeFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AgeFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private AgeFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$request = $this->prophesize();
|
||||
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_age');
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'min_age' => '18',
|
||||
'max_age' => '60',
|
||||
'date_calc' => \DateTime::createFromFormat('Y-m-d', '2020-05-01'),
|
||||
],
|
||||
[ // ça devrait faire boum !
|
||||
'min_age' => '35',
|
||||
'max_age' => '30',
|
||||
'date_calc' => \DateTime::createFromFormat('Y-m-d', '2020-05-01'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -19,7 +19,7 @@ use DateTime;
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BirthdayFilterTest extends AbstractFilterTest
|
||||
final class BirthdateFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private BirthdateFilter $filter;
|
||||
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\DeadOrAliveFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class DeadOrAliveFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private DeadOrAliveFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$request = $this->prophesize();
|
||||
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_dead_or_alive');
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'person_state' => 'alive',
|
||||
'date_calc' => \DateTime::createFromFormat('Y-m-d', '2021-05-01'),
|
||||
],
|
||||
[
|
||||
'person_state' => 'deceased',
|
||||
'date_calc' => \DateTime::createFromFormat('Y-m-d', '2021-05-01'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\DeathdateFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class DeathdateFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private DeathdateFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$request = $this->prophesize();
|
||||
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_deathdate');
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2020-05-01'),
|
||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p'),
|
||||
];
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user