mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix cs
This commit is contained in:
parent
58b1778544
commit
a967e1ed17
@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use DateTime;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
@ -50,14 +49,17 @@ class DateAggregator implements AggregatorInterface
|
|||||||
switch ($data['frequency']) {
|
switch ($data['frequency']) {
|
||||||
case 'month':
|
case 'month':
|
||||||
$fmt = 'YYYY-MM';
|
$fmt = 'YYYY-MM';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'week':
|
case 'week':
|
||||||
$fmt = 'YYYY-IW';
|
$fmt = 'YYYY-IW';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'year':
|
case 'year':
|
||||||
$fmt = 'YYYY'; $order = 'DESC';
|
$fmt = 'YYYY'; $order = 'DESC';
|
||||||
|
|
||||||
break; // order DESC does not works !
|
break; // order DESC does not works !
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -98,7 +100,6 @@ class DateAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
switch ($data['frequency']) {
|
switch ($data['frequency']) {
|
||||||
case 'month':
|
case 'month':
|
||||||
|
|
||||||
case 'week':
|
case 'week':
|
||||||
//return $this->translator->trans('for week') .' '. $value ;
|
//return $this->translator->trans('for week') .' '. $value ;
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
|||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Doctrine\ORM\Query\Expr\Join;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
|
@ -25,8 +25,8 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
|
|
||||||
use function array_key_exists;
|
|
||||||
use function count;
|
use function count;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
$qb->addSelect($elem . ' as ' . $alias);
|
$qb->addSelect($elem . ' as ' . $alias);
|
||||||
|
|
||||||
// make a jointure only if needed
|
// make a jointure only if needed
|
||||||
if (!in_array( 'actreasons', $qb->getAllAliases(), true)) {
|
if (!in_array('actreasons', $qb->getAllAliases(), true)) {
|
||||||
$qb->innerJoin('activity.reasons', 'actreasons');
|
$qb->innerJoin('activity.reasons', 'actreasons');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
@ -57,7 +58,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
if ('export_avg_activity_duration' !== $key) {
|
if ('export_avg_activity_duration' !== $key) {
|
||||||
throw new \LogicException("the key {$key} is not used by this export");
|
throw new LogicException("the key {$key} is not used by this export");
|
||||||
}
|
}
|
||||||
|
|
||||||
return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period duration' : $value;
|
return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period duration' : $value;
|
||||||
@ -99,14 +100,13 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
$qb
|
$qb
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->exists(
|
$qb->expr()->exists(
|
||||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers)
|
->setParameter('authorized_centers', $centers);
|
||||||
;
|
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
||||||
@ -58,7 +59,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
if ('export_avg_activity_visit_duration' !== $key) {
|
if ('export_avg_activity_visit_duration' !== $key) {
|
||||||
throw new \LogicException("the key {$key} is not used by this export");
|
throw new LogicException("the key {$key} is not used by this export");
|
||||||
}
|
}
|
||||||
|
|
||||||
return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period visit duration' : $value;
|
return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period visit duration' : $value;
|
||||||
@ -95,20 +96,18 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
$qb
|
$qb
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->select('AVG(activity.travelTime) as export_avg_activity_visit_duration')
|
->select('AVG(activity.travelTime) as export_avg_activity_visit_duration')
|
||||||
->andWhere($qb->expr()->isNotNull('activity.travelTime'))
|
->andWhere($qb->expr()->isNotNull('activity.travelTime'));
|
||||||
;
|
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->exists(
|
$qb->expr()->exists(
|
||||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers)
|
->setParameter('authorized_centers', $centers);
|
||||||
;
|
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@ -97,14 +97,13 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
$qb
|
$qb
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->exists(
|
$qb->expr()->exists(
|
||||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers)
|
->setParameter('authorized_centers', $centers);
|
||||||
;
|
|
||||||
|
|
||||||
$qb->select('COUNT(DISTINCT activity.id) as export_count_activity');
|
$qb->select('COUNT(DISTINCT activity.id) as export_count_activity');
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
@ -58,7 +59,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
if ('export_sum_activity_duration' !== $key) {
|
if ('export_sum_activity_duration' !== $key) {
|
||||||
throw new \LogicException("the key {$key} is not used by this export");
|
throw new LogicException("the key {$key} is not used by this export");
|
||||||
}
|
}
|
||||||
|
|
||||||
return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period duration' : $value;
|
return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period duration' : $value;
|
||||||
@ -100,14 +101,13 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
$qb
|
$qb
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->exists(
|
$qb->expr()->exists(
|
||||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers)
|
->setParameter('authorized_centers', $centers);
|
||||||
;
|
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class SumActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
class SumActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
||||||
@ -58,7 +59,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
if ('export_sum_activity_visit_duration' !== $key) {
|
if ('export_sum_activity_visit_duration' !== $key) {
|
||||||
throw new \LogicException("the key {$key} is not used by this export");
|
throw new LogicException("the key {$key} is not used by this export");
|
||||||
}
|
}
|
||||||
|
|
||||||
return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period visit duration' : $value;
|
return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period visit duration' : $value;
|
||||||
@ -100,14 +101,13 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
$qb
|
$qb
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->exists(
|
$qb->expr()->exists(
|
||||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
'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)
|
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)
|
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||||
'
|
'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter('authorized_centers', $centers)
|
->setParameter('authorized_centers', $centers);
|
||||||
;
|
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
$qb = $this->activityRepository
|
$qb = $this->activityRepository
|
||||||
->createQueryBuilder('activity')
|
->createQueryBuilder('activity')
|
||||||
->join('activity.person', 'person')
|
->join('activity.person', 'person')
|
||||||
->join('person.centerHistory', 'centerHistory')
|
->join('person.centerHistory', 'centerHistory');
|
||||||
;
|
|
||||||
|
|
||||||
$qb->select('COUNT(activity.id) as export_count_activity');
|
$qb->select('COUNT(activity.id) as export_count_activity');
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ use Chill\MainBundle\Export\FilterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
class ActivityTypeFilter implements FilterInterface
|
class ActivityTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
@ -17,8 +17,6 @@ use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
|||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Doctrine\ORM\Query\Expr;
|
|
||||||
use Doctrine\ORM\Query\Expr\Join;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -79,8 +77,8 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
|||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'expanded' => false,
|
'expanded' => false,
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'class' => 'select2'
|
'class' => 'select2',
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,14 +19,13 @@ use Chill\MainBundle\Export\FilterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\Query\Expr\Join;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
|
|
||||||
use function array_key_exists;
|
|
||||||
use function count;
|
use function count;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
|
@ -14,11 +14,8 @@ namespace Chill\ActivityBundle\Form\Type;
|
|||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Doctrine\DBAL\Types\Types;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
class TranslatableActivityType extends AbstractType
|
class TranslatableActivityType extends AbstractType
|
||||||
|
@ -12,11 +12,8 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
use UnexpectedValueException;
|
|
||||||
|
|
||||||
final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
||||||
{
|
{
|
||||||
@ -27,14 +24,6 @@ final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
|||||||
$this->repository = $em->getRepository(ActivityType::class);
|
$this->repository = $em->getRepository(ActivityType::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array|ActivityType[]
|
|
||||||
*/
|
|
||||||
public function findAllActive(): array
|
|
||||||
{
|
|
||||||
return $this->findBy(['active' => true]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function find($id): ?ActivityType
|
public function find($id): ?ActivityType
|
||||||
{
|
{
|
||||||
return $this->repository->find($id);
|
return $this->repository->find($id);
|
||||||
@ -48,6 +37,14 @@ final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
|||||||
return $this->repository->findAll();
|
return $this->repository->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array|ActivityType[]
|
||||||
|
*/
|
||||||
|
public function findAllActive(): array
|
||||||
|
{
|
||||||
|
return $this->findBy(['active' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|ActivityType[]
|
* @return array|ActivityType[]
|
||||||
*/
|
*/
|
||||||
@ -65,6 +62,4 @@ final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
|||||||
{
|
{
|
||||||
return ActivityType::class;
|
return ActivityType::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
@ -11,5 +20,4 @@ interface ActivityTypeRepositoryInterface extends ObjectRepository
|
|||||||
* @return array|ActivityType[]
|
* @return array|ActivityType[]
|
||||||
*/
|
*/
|
||||||
public function findAllActive(): array;
|
public function findAllActive(): array;
|
||||||
|
|
||||||
}
|
}
|
@ -49,16 +49,16 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
|
|||||||
return $this->getAttributes();
|
return $this->getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
|
||||||
{
|
|
||||||
return $this->helper->voteOnAttribute($attribute, $subject, $token);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function supports($attribute, $subject)
|
protected function supports($attribute, $subject)
|
||||||
{
|
{
|
||||||
return $this->helper->supports($attribute, $subject);
|
return $this->helper->supports($attribute, $subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||||
|
{
|
||||||
|
return $this->helper->voteOnAttribute($attribute, $subject, $token);
|
||||||
|
}
|
||||||
|
|
||||||
private function getAttributes()
|
private function getAttributes()
|
||||||
{
|
{
|
||||||
return [self::STATS, self::LISTS];
|
return [self::STATS, self::LISTS];
|
||||||
|
@ -16,6 +16,10 @@ use Chill\ActivityBundle\Export\Aggregator\ACPAggregators\BySocialActionAggregat
|
|||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
final class BySocialActionAggregatorTest extends AbstractAggregatorTest
|
final class BySocialActionAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
private BySocialActionAggregator $aggregator;
|
private BySocialActionAggregator $aggregator;
|
||||||
@ -52,8 +56,7 @@ final class BySocialActionAggregatorTest extends AbstractAggregatorTest
|
|||||||
->select('count(activity.id)')
|
->select('count(activity.id)')
|
||||||
->from(Activity::class, 'activity')
|
->from(Activity::class, 'activity')
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->join('activity.socialActions', 'actsocialaction')
|
->join('activity.socialActions', 'actsocialaction'),
|
||||||
,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ use Chill\ActivityBundle\Export\Aggregator\ACPAggregators\BySocialIssueAggregato
|
|||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
final class BySocialIssueAggregatorTest extends AbstractAggregatorTest
|
final class BySocialIssueAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
private BySocialIssueAggregator $aggregator;
|
private BySocialIssueAggregator $aggregator;
|
||||||
@ -52,8 +56,7 @@ final class BySocialIssueAggregatorTest extends AbstractAggregatorTest
|
|||||||
->select('count(activity.id)')
|
->select('count(activity.id)')
|
||||||
->from(Activity::class, 'activity')
|
->from(Activity::class, 'activity')
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->join('activity.socialIssues', 'actsocialissue')
|
->join('activity.socialIssues', 'actsocialissue'),
|
||||||
,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ use Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByThirdpartyAggregator
|
|||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
final class ByThirdpartyAggregatorTest extends AbstractAggregatorTest
|
final class ByThirdpartyAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
private ByThirdpartyAggregator $aggregator;
|
private ByThirdpartyAggregator $aggregator;
|
||||||
@ -52,8 +56,7 @@ final class ByThirdpartyAggregatorTest extends AbstractAggregatorTest
|
|||||||
->select('count(activity.id)')
|
->select('count(activity.id)')
|
||||||
->from(Activity::class, 'activity')
|
->from(Activity::class, 'activity')
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->join('activity.thirdParties', 'acttparty')
|
->join('activity.thirdParties', 'acttparty'),
|
||||||
,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ use Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByUserAggregator;
|
|||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
final class ByUserAggregatorTest extends AbstractAggregatorTest
|
final class ByUserAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
private ByUserAggregator $aggregator;
|
private ByUserAggregator $aggregator;
|
||||||
@ -52,8 +56,7 @@ final class ByUserAggregatorTest extends AbstractAggregatorTest
|
|||||||
->select('count(activity.id)')
|
->select('count(activity.id)')
|
||||||
->from(Activity::class, 'activity')
|
->from(Activity::class, 'activity')
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->join('activity.users', 'actusers')
|
->join('activity.users', 'actusers'),
|
||||||
,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ use Chill\ActivityBundle\Export\Aggregator\ACPAggregators\DateAggregator;
|
|||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
final class DateAggregatorTest extends AbstractAggregatorTest
|
final class DateAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
private DateAggregator $aggregator;
|
private DateAggregator $aggregator;
|
||||||
@ -43,7 +47,7 @@ final class DateAggregatorTest extends AbstractAggregatorTest
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'frequency' => 'year',
|
'frequency' => 'year',
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,8 +63,7 @@ final class DateAggregatorTest extends AbstractAggregatorTest
|
|||||||
$em->createQueryBuilder()
|
$em->createQueryBuilder()
|
||||||
->select('count(activity.id)')
|
->select('count(activity.id)')
|
||||||
->from(Activity::class, 'activity')
|
->from(Activity::class, 'activity')
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp'),
|
||||||
,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ use Chill\ActivityBundle\Export\Aggregator\ACPAggregators\LocationTypeAggregator
|
|||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
final class LocationTypeAggregatorTest extends AbstractAggregatorTest
|
final class LocationTypeAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
private LocationTypeAggregator $aggregator;
|
private LocationTypeAggregator $aggregator;
|
||||||
@ -52,8 +56,7 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest
|
|||||||
->select('count(activity.id)')
|
->select('count(activity.id)')
|
||||||
->from(Activity::class, 'activity')
|
->from(Activity::class, 'activity')
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->join('activity.location', 'actloc')
|
->join('activity.location', 'actloc'),
|
||||||
,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ use Chill\ActivityBundle\Export\Aggregator\ACPAggregators\UserScopeAggregator;
|
|||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
final class UserScopeAggregatorTest extends AbstractAggregatorTest
|
final class UserScopeAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
private UserScopeAggregator $aggregator;
|
private UserScopeAggregator $aggregator;
|
||||||
@ -52,8 +56,7 @@ final class UserScopeAggregatorTest extends AbstractAggregatorTest
|
|||||||
->select('count(activity.id)')
|
->select('count(activity.id)')
|
||||||
->from(Activity::class, 'activity')
|
->from(Activity::class, 'activity')
|
||||||
->join('activity.accompanyingPeriod', 'acp')
|
->join('activity.accompanyingPeriod', 'acp')
|
||||||
->join('activity.user', 'actuser')
|
->join('activity.user', 'actuser'),
|
||||||
,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,15 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Tests\Export\Aggregator\PersonAggregators;
|
namespace Chill\ActivityBundle\Tests\Export\Aggregator\PersonAggregators;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator;
|
use Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator;
|
||||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
|
final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
@ -53,7 +53,7 @@ final class ActivityTypeFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'accepted_activitytypes' => $a
|
'accepted_activitytypes' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ final class BySocialActionFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'accepted_socialactions' => $a
|
'accepted_socialactions' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ final class BySocialIssueFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'accepted_socialissues' => $a
|
'accepted_socialissues' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +70,7 @@ final class BySocialIssueFilterTest extends AbstractFilterTest
|
|||||||
$em->createQueryBuilder()
|
$em->createQueryBuilder()
|
||||||
->select('count(activity.id)')
|
->select('count(activity.id)')
|
||||||
->from(Activity::class, 'activity')
|
->from(Activity::class, 'activity')
|
||||||
->join('activity.socialIssues', 'actsocialissue')
|
->join('activity.socialIssues', 'actsocialissue'),
|
||||||
,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ final class ByUserFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'accepted_users' => $a
|
'accepted_users' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ final class EmergencyFilterTest extends AbstractFilterTest
|
|||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['accepted_emergency' => true ],
|
['accepted_emergency' => true],
|
||||||
['accepted_emergency' => false ],
|
['accepted_emergency' => false],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ final class LocationTypeFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'accepted_locationtype' => $a
|
'accepted_locationtype' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ final class SentReceivedFilterTest extends AbstractFilterTest
|
|||||||
public function getFormData(): array
|
public function getFormData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['accepted_sentreceived' => Activity::SENTRECEIVED_SENT ],
|
['accepted_sentreceived' => Activity::SENTRECEIVED_SENT],
|
||||||
['accepted_sentreceived' => Activity::SENTRECEIVED_RECEIVED ]
|
['accepted_sentreceived' => Activity::SENTRECEIVED_RECEIVED],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ final class UserFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'accepted_users' => $a
|
'accepted_users' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ final class UserScopeFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'accepted_userscope' => $a
|
'accepted_userscope' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Tests\Export\Filter;
|
|||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Export\Filter\ActivityDateFilter;
|
use Chill\ActivityBundle\Export\Filter\ActivityDateFilter;
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use DateTime;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,9 +41,9 @@ final class ActivityDateFilterTest extends AbstractFilterTest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2020-01-01'),
|
'date_from' => DateTime::createFromFormat('Y-m-d', '2020-01-01'),
|
||||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2021-01-01'),
|
'date_to' => DateTime::createFromFormat('Y-m-d', '2021-01-01'),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ final class ActivityTypeFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'types' => $a
|
'types' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'reasons' => $a
|
'reasons' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\Activity;
|
|||||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||||
use Chill\ActivityBundle\Export\Filter\PersonFilters\PersonHavingActivityBetweenDateFilter;
|
use Chill\ActivityBundle\Export\Filter\PersonFilters\PersonHavingActivityBetweenDateFilter;
|
||||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||||
|
use DateTime;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,9 +52,9 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
|||||||
|
|
||||||
foreach ($array as $a) {
|
foreach ($array as $a) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2021-07-01'),
|
'date_from' => DateTime::createFromFormat('Y-m-d', '2021-07-01'),
|
||||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-07-01'),
|
'date_to' => DateTime::createFromFormat('Y-m-d', '2022-07-01'),
|
||||||
'reasons' => $a
|
'reasons' => $a,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,14 +70,14 @@ class ConfigRepository
|
|||||||
private function getCharges(bool $onlyActive = false): array
|
private function getCharges(bool $onlyActive = false): array
|
||||||
{
|
{
|
||||||
return $onlyActive ?
|
return $onlyActive ?
|
||||||
array_filter($this->charges, function ($el) { return $el['active']; })
|
array_filter($this->charges, static function ($el) { return $el['active']; })
|
||||||
: $this->charges;
|
: $this->charges;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getResources(bool $onlyActive = false): array
|
private function getResources(bool $onlyActive = false): array
|
||||||
{
|
{
|
||||||
return $onlyActive ?
|
return $onlyActive ?
|
||||||
array_filter($this->resources, function ($el) { return $el['active']; })
|
array_filter($this->resources, static function ($el) { return $el['active']; })
|
||||||
: $this->resources;
|
: $this->resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ use Chill\MainBundle\Templating\Entity\UserRender;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class AgentAggregator implements AggregatorInterface
|
final class AgentAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
class CancelReasonAggregator implements AggregatorInterface
|
class CancelReasonAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class JobAggregator implements AggregatorInterface
|
final class JobAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ use Chill\MainBundle\Repository\LocationRepository;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use function in_array;
|
||||||
|
|
||||||
final class LocationAggregator implements AggregatorInterface
|
final class LocationAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class LocationTypeAggregator implements AggregatorInterface
|
final class LocationTypeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,6 @@ use Chill\MainBundle\Export\AggregatorInterface;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
|
||||||
|
|
||||||
class MonthYearAggregator implements AggregatorInterface
|
class MonthYearAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class ScopeAggregator implements AggregatorInterface
|
final class ScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
class JobFilter implements FilterInterface
|
class JobFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
class ScopeFilter implements FilterInterface
|
class ScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
@ -445,7 +445,7 @@ class ExportController extends AbstractController
|
|||||||
|
|
||||||
$this->logger->notice('[export] choices for an export unserialized', [
|
$this->logger->notice('[export] choices for an export unserialized', [
|
||||||
'key' => $key,
|
'key' => $key,
|
||||||
'rawData' => json_encode($rawData)
|
'rawData' => json_encode($rawData),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$alias = $rawData['alias'];
|
$alias = $rawData['alias'];
|
||||||
|
@ -33,6 +33,11 @@ class GeographicalUnit
|
|||||||
*/
|
*/
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity=GeographicalUnitLayer::class, inversedBy="units")
|
||||||
|
*/
|
||||||
|
private ?GeographicalUnitLayer $layer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
* @ORM\Column(type="text", nullable=false, options={"default": ""})
|
||||||
*/
|
*/
|
||||||
@ -43,21 +48,14 @@ class GeographicalUnit
|
|||||||
*/
|
*/
|
||||||
private string $unitRefId;
|
private string $unitRefId;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=GeographicalUnitLayer::class, inversedBy="units")
|
|
||||||
*/
|
|
||||||
private ?GeographicalUnitLayer $layer;
|
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setId(int $id): self
|
public function getLayer(): ?GeographicalUnitLayer
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
return $this->layer;
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnitName(): ?string
|
public function getUnitName(): ?string
|
||||||
@ -65,31 +63,10 @@ class GeographicalUnit
|
|||||||
return $this->unitName;
|
return $this->unitName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return GeographicalUnitLayer|null
|
|
||||||
*/
|
|
||||||
public function getLayer(): ?GeographicalUnitLayer
|
|
||||||
{
|
|
||||||
return $this->layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $unitRefId
|
|
||||||
* @return GeographicalUnit
|
|
||||||
*/
|
|
||||||
public function setUnitRefId(string $unitRefId): GeographicalUnit
|
|
||||||
{
|
|
||||||
$this->unitRefId = $unitRefId;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param GeographicalUnitLayer|null $layer
|
|
||||||
* @return GeographicalUnit
|
|
||||||
*/
|
|
||||||
public function setLayer(?GeographicalUnitLayer $layer): GeographicalUnit
|
public function setLayer(?GeographicalUnitLayer $layer): GeographicalUnit
|
||||||
{
|
{
|
||||||
$this->layer = $layer;
|
$this->layer = $layer;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,4 +76,18 @@ class GeographicalUnit
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUnitRefId(string $unitRefId): GeographicalUnit
|
||||||
|
{
|
||||||
|
$this->unitRefId = $unitRefId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setId(int $id): self
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\MainBundle\Entity;
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
@ -41,45 +50,30 @@ class GeographicalUnitLayer
|
|||||||
$this->units = new ArrayCollection();
|
$this->units = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int|null
|
|
||||||
*/
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getName(): array
|
public function getName(): array
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $name
|
|
||||||
* @return GeographicalUnitLayer
|
|
||||||
*/
|
|
||||||
public function setName(array $name): GeographicalUnitLayer
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getRefId(): string
|
public function getRefId(): string
|
||||||
{
|
{
|
||||||
return $this->refId;
|
return $this->refId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getUnits(): Collection
|
public function getUnits(): Collection
|
||||||
{
|
{
|
||||||
return $this->units;
|
return $this->units;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setName(array $name): GeographicalUnitLayer
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
@ -13,7 +13,6 @@ namespace Chill\MainBundle\Export;
|
|||||||
|
|
||||||
use Chill\MainBundle\Form\Type\Export\ExportType;
|
use Chill\MainBundle\Form\Type\Export\ExportType;
|
||||||
use Chill\MainBundle\Form\Type\Export\PickCenterType;
|
use Chill\MainBundle\Form\Type\Export\PickCenterType;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@ -265,16 +264,14 @@ class ExportManager
|
|||||||
$this->handleAggregators($export, $query, $data[ExportType::AGGREGATOR_KEY], $centers);
|
$this->handleAggregators($export, $query, $data[ExportType::AGGREGATOR_KEY], $centers);
|
||||||
|
|
||||||
$this->logger->notice('[export] will execute this qb in export', [
|
$this->logger->notice('[export] will execute this qb in export', [
|
||||||
'dql' => $query->getDQL()
|
'dql' => $query->getDQL(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new UnexpectedValueException('The method `intiateQuery` should return '
|
throw new UnexpectedValueException('The method `intiateQuery` should return '
|
||||||
. 'a `\\Doctrine\\ORM\\NativeQuery` or a `Doctrine\\ORM\\QueryBuilder` '
|
. 'a `\\Doctrine\\ORM\\NativeQuery` or a `Doctrine\\ORM\\QueryBuilder` '
|
||||||
. 'object.');
|
. 'object.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = $export->getResult($query, $data[ExportType::EXPORT_KEY]);
|
$result = $export->getResult($query, $data[ExportType::EXPORT_KEY]);
|
||||||
|
|
||||||
if (!is_iterable($result)) {
|
if (!is_iterable($result)) {
|
||||||
|
@ -14,9 +14,7 @@ namespace Chill\MainBundle\Form\Type\Export;
|
|||||||
use Chill\MainBundle\Center\GroupingCenterInterface;
|
use Chill\MainBundle\Center\GroupingCenterInterface;
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Export\ExportManager;
|
use Chill\MainBundle\Export\ExportManager;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\CallbackTransformer;
|
use Symfony\Component\Form\CallbackTransformer;
|
||||||
@ -49,9 +47,6 @@ class PickCenterType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
protected array $groupingCenters = [];
|
protected array $groupingCenters = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \Symfony\Component\Security\Core\User\UserInterface
|
|
||||||
*/
|
|
||||||
protected UserInterface $user;
|
protected UserInterface $user;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -14,7 +14,6 @@ namespace Chill\MainBundle\Repository;
|
|||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
|
||||||
|
|
||||||
final class CenterRepository implements CenterRepositoryInterface
|
final class CenterRepository implements CenterRepositoryInterface
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\MainBundle\Repository;
|
namespace Chill\MainBundle\Repository;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
@ -8,7 +17,7 @@ use Doctrine\Persistence\ObjectRepository;
|
|||||||
interface CenterRepositoryInterface extends ObjectRepository
|
interface CenterRepositoryInterface extends ObjectRepository
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Return all active centers
|
* Return all active centers.
|
||||||
*
|
*
|
||||||
* Note: this is a teaser: active will comes later on center entity
|
* Note: this is a teaser: active will comes later on center entity
|
||||||
*
|
*
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
<?php
|
<?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\MainBundle\Repository;
|
namespace Chill\MainBundle\Repository;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\GeographicalUnit;
|
|
||||||
use Chill\MainBundle\Entity\GeographicalUnitLayer;
|
use Chill\MainBundle\Entity\GeographicalUnitLayer;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use UnexpectedValueException;
|
|
||||||
|
|
||||||
final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface
|
final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface
|
||||||
{
|
{
|
||||||
@ -30,6 +37,15 @@ final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLaye
|
|||||||
return $this->repository->findAll();
|
return $this->repository->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findAllHavingUnits(): array
|
||||||
|
{
|
||||||
|
$qb = $this->repository->createQueryBuilder('l');
|
||||||
|
|
||||||
|
return $qb->where($qb->expr()->gt('SIZE(l.units)', 0))
|
||||||
|
->getQuery()
|
||||||
|
->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|GeographicalUnitLayer[]
|
* @return array|GeographicalUnitLayer[]
|
||||||
*/
|
*/
|
||||||
@ -47,13 +63,4 @@ final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLaye
|
|||||||
{
|
{
|
||||||
return GeographicalUnitLayer::class;
|
return GeographicalUnitLayer::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findAllHavingUnits(): array
|
|
||||||
{
|
|
||||||
$qb = $this->repository->createQueryBuilder('l');
|
|
||||||
|
|
||||||
return $qb->where($qb->expr()->gt('SIZE(l.units)', 0))
|
|
||||||
->getQuery()
|
|
||||||
->getResult();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\MainBundle\Repository;
|
namespace Chill\MainBundle\Repository;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\GeographicalUnitLayer;
|
use Chill\MainBundle\Entity\GeographicalUnitLayer;
|
||||||
|
@ -1,33 +1,39 @@
|
|||||||
<?php
|
<?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\MainBundle\Repository;
|
namespace Chill\MainBundle\Repository;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\GeographicalUnit;
|
use Chill\MainBundle\Entity\GeographicalUnit;
|
||||||
use Chill\MainBundle\Entity\GeographicalUnitDTO;
|
|
||||||
use Chill\MainBundle\Entity\GeographicalUnitLayer;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|
||||||
class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
|
class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private EntityRepository $repository;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->repository = $em->getRepository($this->getClassName());
|
$this->repository = $em->getRepository($this->getClassName());
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function find($id): ?GeographicalUnit
|
public function find($id): ?GeographicalUnit
|
||||||
{
|
{
|
||||||
return $this->repository->find($id);
|
return $this->repository->find($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will return only partial object, where the @link{GeographicalUnit::geom} property is not loaded
|
* Will return only partial object, where the @see{GeographicalUnit::geom} property is not loaded.
|
||||||
*
|
*
|
||||||
* @return array|GeographicalUnit[]
|
* @return array|GeographicalUnit[]
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
<?php
|
<?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\MainBundle\Repository;
|
namespace Chill\MainBundle\Repository;
|
||||||
|
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
interface GeographicalUnitRepositoryInterface extends ObjectRepository
|
interface GeographicalUnitRepositoryInterface extends ObjectRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\Scope;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Doctrine\Persistence\ObjectRepository;
|
|
||||||
|
|
||||||
final class ScopeRepository implements ScopeRepositoryInterface
|
final class ScopeRepository implements ScopeRepositoryInterface
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\MainBundle\Repository;
|
namespace Chill\MainBundle\Repository;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
@ -18,6 +27,9 @@ interface ScopeRepositoryInterface extends ObjectRepository
|
|||||||
public function findAll(): array;
|
public function findAll(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param null|mixed $limit
|
||||||
|
* @param null|mixed $offset
|
||||||
|
*
|
||||||
* @return Scope[]
|
* @return Scope[]
|
||||||
*/
|
*/
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array;
|
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array;
|
||||||
|
@ -11,7 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Security\Authorization;
|
namespace Chill\MainBundle\Security\Authorization;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ use Doctrine\DBAL\Statement;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use RuntimeException;
|
||||||
use function array_key_exists;
|
use function array_key_exists;
|
||||||
use function count;
|
use function count;
|
||||||
|
|
||||||
@ -159,8 +160,8 @@ final class AddressReferenceBaseImporter
|
|||||||
try {
|
try {
|
||||||
$affected = $statement->executeStatement(array_merge(...$this->waitingForInsert));
|
$affected = $statement->executeStatement(array_merge(...$this->waitingForInsert));
|
||||||
|
|
||||||
if ($affected === 0) {
|
if (0 === $affected) {
|
||||||
throw new \RuntimeException('no row affected');
|
throw new RuntimeException('no row affected');
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// in some case, we can add debug code here
|
// in some case, we can add debug code here
|
||||||
|
@ -13,11 +13,10 @@ namespace Chill\MainBundle\Service\Import;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
use Doctrine\DBAL\Statement;
|
use Doctrine\DBAL\Statement;
|
||||||
use Doctrine\DBAL\Types\Type;
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Exception;
|
use Exception;
|
||||||
use LogicException;
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use RuntimeException;
|
||||||
use function array_key_exists;
|
use function array_key_exists;
|
||||||
use function count;
|
use function count;
|
||||||
|
|
||||||
@ -77,7 +76,7 @@ final class GeographicalUnitBaseImporter
|
|||||||
string $unitName,
|
string $unitName,
|
||||||
string $unitKey,
|
string $unitKey,
|
||||||
string $geomAsWKT,
|
string $geomAsWKT,
|
||||||
int $srid = null
|
?int $srid = null
|
||||||
): void {
|
): void {
|
||||||
$this->initialize();
|
$this->initialize();
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ final class GeographicalUnitBaseImporter
|
|||||||
'unitName' => $unitName,
|
'unitName' => $unitName,
|
||||||
'unitKey' => $unitKey,
|
'unitKey' => $unitKey,
|
||||||
'geomAsWKT' => $geomAsWKT,
|
'geomAsWKT' => $geomAsWKT,
|
||||||
'srid' => $srid
|
'srid' => $srid,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (100 <= count($this->waitingForInsert)) {
|
if (100 <= count($this->waitingForInsert)) {
|
||||||
@ -138,8 +137,10 @@ final class GeographicalUnitBaseImporter
|
|||||||
}
|
}
|
||||||
|
|
||||||
$statement = $this->cachingStatements[$forNumber];
|
$statement = $this->cachingStatements[$forNumber];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
foreach ($this->waitingForInsert as $insert) {
|
foreach ($this->waitingForInsert as $insert) {
|
||||||
$statement->bindValue(++$i, $insert['layerKey'], Types::STRING);
|
$statement->bindValue(++$i, $insert['layerKey'], Types::STRING);
|
||||||
$statement->bindValue(++$i, $insert['layerName'], Types::JSON);
|
$statement->bindValue(++$i, $insert['layerName'], Types::JSON);
|
||||||
@ -151,8 +152,8 @@ final class GeographicalUnitBaseImporter
|
|||||||
|
|
||||||
$affected = $statement->executeStatement();
|
$affected = $statement->executeStatement();
|
||||||
|
|
||||||
if ($affected === 0) {
|
if (0 === $affected) {
|
||||||
throw new \RuntimeException('no row affected');
|
throw new RuntimeException('no row affected');
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
@ -182,7 +183,7 @@ final class GeographicalUnitBaseImporter
|
|||||||
private function updateGeographicalUnitTable(): void
|
private function updateGeographicalUnitTable(): void
|
||||||
{
|
{
|
||||||
$this->defaultConnection->transactional(
|
$this->defaultConnection->transactional(
|
||||||
function() {
|
function () {
|
||||||
// 0) create new layers
|
// 0) create new layers
|
||||||
$this->defaultConnection->executeStatement(
|
$this->defaultConnection->executeStatement(
|
||||||
"
|
"
|
||||||
@ -197,7 +198,8 @@ final class GeographicalUnitBaseImporter
|
|||||||
FROM unique_layers
|
FROM unique_layers
|
||||||
ON CONFLICT (refid)
|
ON CONFLICT (refid)
|
||||||
DO UPDATE SET name=EXCLUDED.name
|
DO UPDATE SET name=EXCLUDED.name
|
||||||
");
|
"
|
||||||
|
);
|
||||||
|
|
||||||
//1) Add new units
|
//1) Add new units
|
||||||
$this->logger->info(self::LOG_PREFIX . 'upsert new units');
|
$this->logger->info(self::LOG_PREFIX . 'upsert new units');
|
||||||
|
@ -25,6 +25,7 @@ use function is_string;
|
|||||||
/**
|
/**
|
||||||
* Helper which creates a set of test for aggregators.
|
* Helper which creates a set of test for aggregators.
|
||||||
*
|
*
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
abstract class AbstractAggregatorTest extends KernelTestCase
|
abstract class AbstractAggregatorTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@ use function is_string;
|
|||||||
/**
|
/**
|
||||||
* Helper to test filters.
|
* Helper to test filters.
|
||||||
*
|
*
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
abstract class AbstractFilterTest extends KernelTestCase
|
abstract class AbstractFilterTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@ namespace Chill\MainBundle\Test;
|
|||||||
* and use tearDownTrait after usage.
|
* and use tearDownTrait after usage.
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
*
|
||||||
* @deprecated use @class{Prophecy\PhpUnit\ProphecyTrait} instead
|
* @deprecated use @class{Prophecy\PhpUnit\ProphecyTrait} instead
|
||||||
*/
|
*/
|
||||||
trait ProphecyTrait
|
trait ProphecyTrait
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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 Services\Import;
|
namespace Services\Import;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\PostalCode;
|
use Chill\MainBundle\Entity\PostalCode;
|
||||||
@ -9,11 +18,18 @@ use Chill\MainBundle\Service\Import\AddressReferenceBaseImporter;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class AddressReferenceBaseImporterTest extends KernelTestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class AddressReferenceBaseImporterTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
private AddressReferenceBaseImporter $importer;
|
|
||||||
private AddressReferenceRepository $addressReferenceRepository;
|
private AddressReferenceRepository $addressReferenceRepository;
|
||||||
|
|
||||||
private EntityManagerInterface $entityManager;
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
||||||
|
private AddressReferenceBaseImporter $importer;
|
||||||
|
|
||||||
private PostalCodeRepository $postalCodeRepository;
|
private PostalCodeRepository $postalCodeRepository;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
@ -30,7 +46,7 @@ class AddressReferenceBaseImporterTest extends KernelTestCase
|
|||||||
public function testImportAddress(): void
|
public function testImportAddress(): void
|
||||||
{
|
{
|
||||||
$postalCode = (new PostalCode())
|
$postalCode = (new PostalCode())
|
||||||
->setRefPostalCodeId($postalCodeId = '1234'.uniqid())
|
->setRefPostalCodeId($postalCodeId = '1234' . uniqid())
|
||||||
->setPostalCodeSource('testing')
|
->setPostalCodeSource('testing')
|
||||||
->setCode('TEST456')
|
->setCode('TEST456')
|
||||||
->setName('testing');
|
->setName('testing');
|
||||||
@ -54,7 +70,8 @@ class AddressReferenceBaseImporterTest extends KernelTestCase
|
|||||||
|
|
||||||
$addresses = $this->addressReferenceRepository->findByPostalCodePattern(
|
$addresses = $this->addressReferenceRepository->findByPostalCodePattern(
|
||||||
$postalCode,
|
$postalCode,
|
||||||
'Rue test abcc guessed');
|
'Rue test abcc guessed'
|
||||||
|
);
|
||||||
|
|
||||||
$this->assertCount(1, $addresses);
|
$this->assertCount(1, $addresses);
|
||||||
$this->assertEquals('Rue test abccc-guessed', $addresses[0]->getStreet());
|
$this->assertEquals('Rue test abccc-guessed', $addresses[0]->getStreet());
|
||||||
@ -79,12 +96,11 @@ class AddressReferenceBaseImporterTest extends KernelTestCase
|
|||||||
|
|
||||||
$addresses = $this->addressReferenceRepository->findByPostalCodePattern(
|
$addresses = $this->addressReferenceRepository->findByPostalCodePattern(
|
||||||
$postalCode,
|
$postalCode,
|
||||||
'abcc guessed fixed');
|
'abcc guessed fixed'
|
||||||
|
);
|
||||||
|
|
||||||
$this->assertCount('1', $addresses);
|
$this->assertCount('1', $addresses);
|
||||||
$this->assertEquals( 'Rue test abccc guessed fixed', $addresses[0]->getStreet());
|
$this->assertEquals('Rue test abccc guessed fixed', $addresses[0]->getStreet());
|
||||||
$this->assertEquals($previousAddressId, $addresses[0]->getId());
|
$this->assertEquals($previousAddressId, $addresses[0]->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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 Services\Import;
|
namespace Services\Import;
|
||||||
|
|
||||||
use Chill\MainBundle\Service\Import\GeographicalUnitBaseImporter;
|
use Chill\MainBundle\Service\Import\GeographicalUnitBaseImporter;
|
||||||
@ -8,7 +17,11 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Psr\Log\NullLogger;
|
use Psr\Log\NullLogger;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class GeographicalUnitBaseImporterTest extends KernelTestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class GeographicalUnitBaseImporterTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
private Connection $connection;
|
private Connection $connection;
|
||||||
|
|
||||||
@ -42,10 +55,10 @@ class GeographicalUnitBaseImporterTest extends KernelTestCase
|
|||||||
|
|
||||||
$importer->finalize();
|
$importer->finalize();
|
||||||
|
|
||||||
$unit = $this->connection->executeQuery("
|
$unit = $this->connection->executeQuery('
|
||||||
SELECT unitname, unitrefid, cmgul.refid AS layerrefid, cmgul.name AS layername, ST_AsText(ST_snapToGrid(ST_Transform(u.geom, 3812), 1)) AS geom
|
SELECT unitname, unitrefid, cmgul.refid AS layerrefid, cmgul.name AS layername, ST_AsText(ST_snapToGrid(ST_Transform(u.geom, 3812), 1)) AS geom
|
||||||
FROM chill_main_geographical_unit u JOIN chill_main_geographical_unit_layer cmgul on u.layer_id = cmgul.id
|
FROM chill_main_geographical_unit u JOIN chill_main_geographical_unit_layer cmgul on u.layer_id = cmgul.id
|
||||||
WHERE u.unitrefid = ?", ['layer_one']);
|
WHERE u.unitrefid = ?', ['layer_one']);
|
||||||
|
|
||||||
$results = $unit->fetchAssociative();
|
$results = $unit->fetchAssociative();
|
||||||
|
|
||||||
@ -71,10 +84,10 @@ class GeographicalUnitBaseImporterTest extends KernelTestCase
|
|||||||
|
|
||||||
$importer->finalize();
|
$importer->finalize();
|
||||||
|
|
||||||
$unit = $this->connection->executeQuery("
|
$unit = $this->connection->executeQuery('
|
||||||
SELECT unitname, unitrefid, cmgul.refid AS layerrefid, cmgul.name AS layername, ST_AsText(ST_snapToGrid(ST_Transform(u.geom, 3812), 1)) AS geom
|
SELECT unitname, unitrefid, cmgul.refid AS layerrefid, cmgul.name AS layername, ST_AsText(ST_snapToGrid(ST_Transform(u.geom, 3812), 1)) AS geom
|
||||||
FROM chill_main_geographical_unit u JOIN chill_main_geographical_unit_layer cmgul on u.layer_id = cmgul.id
|
FROM chill_main_geographical_unit u JOIN chill_main_geographical_unit_layer cmgul on u.layer_id = cmgul.id
|
||||||
WHERE u.unitrefid = ?", ['layer_one']);
|
WHERE u.unitrefid = ?', ['layer_one']);
|
||||||
|
|
||||||
$results = $unit->fetchAssociative();
|
$results = $unit->fetchAssociative();
|
||||||
|
|
||||||
@ -83,7 +96,5 @@ class GeographicalUnitBaseImporterTest extends KernelTestCase
|
|||||||
$this->assertEquals(json_decode($results['layername'], true), ['fr' => 'Test Layer fixed']);
|
$this->assertEquals(json_decode($results['layername'], true), ['fr' => 'Test Layer fixed']);
|
||||||
$this->assertEquals($results['layerrefid'], 'test');
|
$this->assertEquals($results['layerrefid'], 'test');
|
||||||
$this->assertEquals($results['geom'], 'MULTIPOLYGON(((130 120,45 40,10 40,130 120)),((0 0,15 5,40 10,10 20,0 0)))');
|
$this->assertEquals($results['geom'], 'MULTIPOLYGON(((130 120,45 40,10 40,130 120)),((0 0,15 5,40 10,10 20,0 0)))');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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 Services\Import;
|
namespace Services\Import;
|
||||||
|
|
||||||
use Chill\MainBundle\Repository\CountryRepository;
|
use Chill\MainBundle\Repository\CountryRepository;
|
||||||
@ -8,16 +17,20 @@ use Chill\MainBundle\Service\Import\PostalCodeBaseImporter;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class PostalCodeBaseImporterTest extends KernelTestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class PostalCodeBaseImporterTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
private CountryRepository $countryRepository;
|
||||||
|
|
||||||
private EntityManagerInterface $entityManager;
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
||||||
private PostalCodeBaseImporter $importer;
|
private PostalCodeBaseImporter $importer;
|
||||||
|
|
||||||
private PostalCodeRepository $postalCodeRepository;
|
private PostalCodeRepository $postalCodeRepository;
|
||||||
|
|
||||||
private CountryRepository $countryRepository;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
@ -34,9 +47,9 @@ class PostalCodeBaseImporterTest extends KernelTestCase
|
|||||||
{
|
{
|
||||||
$this->importer->importCode(
|
$this->importer->importCode(
|
||||||
'BE',
|
'BE',
|
||||||
'tested with pattern '. ($uniqid = uniqid()),
|
'tested with pattern ' . ($uniqid = uniqid()),
|
||||||
'12345',
|
'12345',
|
||||||
$refPostalCodeId = 'test'.uniqid(),
|
$refPostalCodeId = 'test' . uniqid(),
|
||||||
'test',
|
'test',
|
||||||
50.0,
|
50.0,
|
||||||
5.0,
|
5.0,
|
||||||
@ -46,7 +59,7 @@ class PostalCodeBaseImporterTest extends KernelTestCase
|
|||||||
$this->importer->finalize();
|
$this->importer->finalize();
|
||||||
|
|
||||||
$postalCodes = $this->postalCodeRepository->findByPattern(
|
$postalCodes = $this->postalCodeRepository->findByPattern(
|
||||||
'with pattern '.$uniqid,
|
'with pattern ' . $uniqid,
|
||||||
$this->countryRepository->findOneBy(['countryCode' => 'BE'])
|
$this->countryRepository->findOneBy(['countryCode' => 'BE'])
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -59,7 +72,7 @@ class PostalCodeBaseImporterTest extends KernelTestCase
|
|||||||
|
|
||||||
$this->importer->importCode(
|
$this->importer->importCode(
|
||||||
'BE',
|
'BE',
|
||||||
'tested with adapted pattern '. ($uniqid = uniqid()),
|
'tested with adapted pattern ' . ($uniqid = uniqid()),
|
||||||
'12345',
|
'12345',
|
||||||
$refPostalCodeId,
|
$refPostalCodeId,
|
||||||
'test',
|
'test',
|
||||||
@ -71,7 +84,7 @@ class PostalCodeBaseImporterTest extends KernelTestCase
|
|||||||
$this->importer->finalize();
|
$this->importer->finalize();
|
||||||
|
|
||||||
$postalCodes = $this->postalCodeRepository->findByPattern(
|
$postalCodes = $this->postalCodeRepository->findByPattern(
|
||||||
'with pattern '.$uniqid,
|
'with pattern ' . $uniqid,
|
||||||
$this->countryRepository->findOneBy(['countryCode' => 'BE'])
|
$this->countryRepository->findOneBy(['countryCode' => 'BE'])
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -79,7 +92,4 @@ class PostalCodeBaseImporterTest extends KernelTestCase
|
|||||||
$this->assertStringStartsWith('tested with adapted pattern', $postalCodes[0]->getName());
|
$this->assertStringStartsWith('tested with adapted pattern', $postalCodes[0]->getName());
|
||||||
$this->assertEquals($previousId, $postalCodes[0]->getId());
|
$this->assertEquals($previousId, $postalCodes[0]->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\MainBundle\Tests\Workflow\EventSubscriber;
|
namespace Chill\MainBundle\Tests\Workflow\EventSubscriber;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Notification;
|
use Chill\MainBundle\Entity\Notification;
|
||||||
@ -14,16 +23,22 @@ use Prophecy\Argument;
|
|||||||
use Prophecy\Call\Call;
|
use Prophecy\Call\Call;
|
||||||
use Prophecy\Exception\Prediction\FailedPredictionException;
|
use Prophecy\Exception\Prediction\FailedPredictionException;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
|
use ReflectionClass;
|
||||||
|
use stdClass;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Component\Templating\EngineInterface;
|
use Symfony\Component\Templating\EngineInterface;
|
||||||
use Symfony\Component\Workflow\Event\Event;
|
use Symfony\Component\Workflow\Event\Event;
|
||||||
use Symfony\Component\Workflow\Marking;
|
use Symfony\Component\Workflow\Marking;
|
||||||
use Symfony\Component\Workflow\Registry;
|
use Symfony\Component\Workflow\Registry;
|
||||||
use Symfony\Component\Workflow\Transition;
|
use Symfony\Component\Workflow\Transition;
|
||||||
use Symfony\Component\Workflow\Workflow;
|
|
||||||
use Symfony\Component\Workflow\WorkflowInterface;
|
use Symfony\Component\Workflow\WorkflowInterface;
|
||||||
|
use function count;
|
||||||
|
|
||||||
class NotificationOnTransitionTest extends TestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class NotificationOnTransitionTest extends TestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
@ -36,11 +51,10 @@ class NotificationOnTransitionTest extends TestCase
|
|||||||
$entityWorkflow = new EntityWorkflow();
|
$entityWorkflow = new EntityWorkflow();
|
||||||
$entityWorkflow
|
$entityWorkflow
|
||||||
->setWorkflowName('workflow_name')
|
->setWorkflowName('workflow_name')
|
||||||
->setRelatedEntityClass(\stdClass::class)
|
->setRelatedEntityClass(stdClass::class)
|
||||||
->setRelatedEntityId(1)
|
->setRelatedEntityId(1);
|
||||||
;
|
|
||||||
// force an id to entityWorkflow:
|
// force an id to entityWorkflow:
|
||||||
$reflection = new \ReflectionClass($entityWorkflow);
|
$reflection = new ReflectionClass($entityWorkflow);
|
||||||
$id = $reflection->getProperty('id');
|
$id = $reflection->getProperty('id');
|
||||||
$id->setAccessible(true);
|
$id->setAccessible(true);
|
||||||
$id->setValue($entityWorkflow, 1);
|
$id->setValue($entityWorkflow, 1);
|
||||||
@ -48,12 +62,11 @@ class NotificationOnTransitionTest extends TestCase
|
|||||||
$step = new EntityWorkflowStep();
|
$step = new EntityWorkflowStep();
|
||||||
$entityWorkflow->addStep($step);
|
$entityWorkflow->addStep($step);
|
||||||
$step->addDestUser($dest)
|
$step->addDestUser($dest)
|
||||||
->setCurrentStep('to_state')
|
->setCurrentStep('to_state');
|
||||||
;
|
|
||||||
|
|
||||||
$em = $this->prophesize(EntityManagerInterface::class);
|
$em = $this->prophesize(EntityManagerInterface::class);
|
||||||
$em->persist(Argument::type(Notification::class))->should(
|
$em->persist(Argument::type(Notification::class))->should(
|
||||||
function($args) use ($dest) {
|
static function ($args) use ($dest) {
|
||||||
/** @var Call[] $args */
|
/** @var Call[] $args */
|
||||||
if (1 !== count($args)) {
|
if (1 !== count($args)) {
|
||||||
throw new FailedPredictionException('no notification sent');
|
throw new FailedPredictionException('no notification sent');
|
||||||
@ -68,7 +81,8 @@ class NotificationOnTransitionTest extends TestCase
|
|||||||
if (!$notification->getAddressees()->contains($dest)) {
|
if (!$notification->getAddressees()->contains($dest)) {
|
||||||
throw new FailedPredictionException('the dest is not notified');
|
throw new FailedPredictionException('the dest is not notified');
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$engine = $this->prophesize(EngineInterface::class);
|
$engine = $this->prophesize(EngineInterface::class);
|
||||||
$engine->render(Argument::type('string'), Argument::type('array'))
|
$engine->render(Argument::type('string'), Argument::type('array'))
|
||||||
|
@ -41,6 +41,24 @@ class EntityWorkflowTransitionEventSubscriber implements EventSubscriberInterfac
|
|||||||
$this->userRender = $userRender;
|
$this->userRender = $userRender;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addDests(Event $event): void
|
||||||
|
{
|
||||||
|
if (!$event->getSubject() instanceof EntityWorkflow) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var EntityWorkflow $entityWorkflow */
|
||||||
|
$entityWorkflow = $event->getSubject();
|
||||||
|
|
||||||
|
foreach ($entityWorkflow->futureDestUsers as $user) {
|
||||||
|
$entityWorkflow->getCurrentStep()->addDestUser($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($entityWorkflow->futureDestEmails as $email) {
|
||||||
|
$entityWorkflow->getCurrentStep()->addDestEmail($email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -55,23 +73,6 @@ class EntityWorkflowTransitionEventSubscriber implements EventSubscriberInterfac
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addDests(Event $event): void
|
|
||||||
{
|
|
||||||
if (!$event->getSubject() instanceof EntityWorkflow) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var EntityWorkflow $entityWorkflow */
|
|
||||||
$entityWorkflow = $event->getSubject();
|
|
||||||
foreach ($entityWorkflow->futureDestUsers as $user) {
|
|
||||||
$entityWorkflow->getCurrentStep()->addDestUser($user);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($entityWorkflow->futureDestEmails as $email) {
|
|
||||||
$entityWorkflow->getCurrentStep()->addDestEmail($email);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function guardEntityWorkflow(GuardEvent $event)
|
public function guardEntityWorkflow(GuardEvent $event)
|
||||||
{
|
{
|
||||||
if (!$event->getSubject() instanceof EntityWorkflow) {
|
if (!$event->getSubject() instanceof EntityWorkflow) {
|
||||||
|
@ -57,14 +57,15 @@ class NotificationOnTransition implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a notification to:
|
* Send a notification to:.
|
||||||
*
|
*
|
||||||
* * the dests of the new step;
|
* * the dests of the new step;
|
||||||
* * the users which subscribed to workflow, on each step, or on final
|
* * the users which subscribed to workflow, on each step, or on final
|
||||||
*
|
*
|
||||||
* **Warning** take care that this method must be executed **after** the dest users are added to
|
* **Warning** take care that this method must be executed **after** the dest users are added to
|
||||||
* the step (@link{EntityWorkflowStep::addDestUser}). Currently, this is done during
|
* the step (@see{EntityWorkflowStep::addDestUser}). Currently, this is done during
|
||||||
* @link{EntityWorkflowTransitionEventSubscriber::addDests}.
|
*
|
||||||
|
* @see{EntityWorkflowTransitionEventSubscriber::addDests}.
|
||||||
*/
|
*/
|
||||||
public function onCompletedSendNotification(Event $event): void
|
public function onCompletedSendNotification(Event $event): void
|
||||||
{
|
{
|
||||||
@ -77,6 +78,7 @@ class NotificationOnTransition implements EventSubscriberInterface
|
|||||||
|
|
||||||
/** @var array<string, User> $dests array of unique values, where keys is the object's hash */
|
/** @var array<string, User> $dests array of unique values, where keys is the object's hash */
|
||||||
$dests = [];
|
$dests = [];
|
||||||
|
|
||||||
foreach (array_merge(
|
foreach (array_merge(
|
||||||
// the subscriber to each step
|
// the subscriber to each step
|
||||||
$entityWorkflow->getSubscriberToStep()->toArray(),
|
$entityWorkflow->getSubscriberToStep()->toArray(),
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Main;
|
namespace Chill\Migrations\Main;
|
||||||
@ -9,6 +16,11 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20220730204216 extends AbstractMigration
|
final class Version20220730204216 extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('DROP INDEX chill_main_address_reference_unicity');
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Add an unique constraint on addresses references';
|
return 'Add an unique constraint on addresses references';
|
||||||
@ -18,9 +30,4 @@ final class Version20220730204216 extends AbstractMigration
|
|||||||
{
|
{
|
||||||
$this->addSql('CREATE UNIQUE INDEX chill_main_address_reference_unicity ON chill_main_address_reference (refId, source)');
|
$this->addSql('CREATE UNIQUE INDEX chill_main_address_reference_unicity ON chill_main_address_reference (refId, source)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('DROP INDEX chill_main_address_reference_unicity');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Main;
|
namespace Chill\Migrations\Main;
|
||||||
@ -12,6 +19,11 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
*/
|
*/
|
||||||
final class Version20220913174922 extends AbstractMigration
|
final class Version20220913174922 extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER COLUMN geom SET DATA TYPE TEXT');
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Geographical Unit correction';
|
return 'Geographical Unit correction';
|
||||||
@ -21,9 +33,4 @@ final class Version20220913174922 extends AbstractMigration
|
|||||||
{
|
{
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER COLUMN geom SET DATA TYPE GEOMETRY(MULTIPOLYGON, 4326)');
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER COLUMN geom SET DATA TYPE GEOMETRY(MULTIPOLYGON, 4326)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER COLUMN geom SET DATA TYPE TEXT');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Main;
|
namespace Chill\Migrations\Main;
|
||||||
@ -9,6 +16,24 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20221003112151 extends AbstractMigration
|
final class Version20221003112151 extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->throwIrreversibleMigrationException();
|
||||||
|
|
||||||
|
/* for memory
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit DROP CONSTRAINT FK_360A2B2FEA6EFDCD');
|
||||||
|
$this->addSql('DROP SEQUENCE chill_main_geographical_unit_layer_id_seq CASCADE');
|
||||||
|
$this->addSql('DROP TABLE chill_main_geographical_unit_layer');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ADD layername VARCHAR(255) DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit DROP layer_id');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit DROP unitRefId');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER geom TYPE VARCHAR(255)');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER unitName TYPE VARCHAR(255)');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER unitName DROP DEFAULT');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER unitName DROP NOT NULL');
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Add a proper entity for GeographicalUnitLayer';
|
return 'Add a proper entity for GeographicalUnitLayer';
|
||||||
@ -35,24 +60,5 @@ final class Version20221003112151 extends AbstractMigration
|
|||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER unitname SET NOT NULL');
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER unitname SET NOT NULL');
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ADD CONSTRAINT FK_360A2B2FEA6EFDCD FOREIGN KEY (layer_id) REFERENCES chill_main_geographical_unit_layer (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
$this->addSql('ALTER TABLE chill_main_geographical_unit ADD CONSTRAINT FK_360A2B2FEA6EFDCD FOREIGN KEY (layer_id) REFERENCES chill_main_geographical_unit_layer (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
$this->addSql('CREATE INDEX IDX_360A2B2FEA6EFDCD ON chill_main_geographical_unit (layer_id)');
|
$this->addSql('CREATE INDEX IDX_360A2B2FEA6EFDCD ON chill_main_geographical_unit (layer_id)');
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->throwIrreversibleMigrationException();
|
|
||||||
|
|
||||||
/* for memory
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit DROP CONSTRAINT FK_360A2B2FEA6EFDCD');
|
|
||||||
$this->addSql('DROP SEQUENCE chill_main_geographical_unit_layer_id_seq CASCADE');
|
|
||||||
$this->addSql('DROP TABLE chill_main_geographical_unit_layer');
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ADD layername VARCHAR(255) DEFAULT NULL');
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit DROP layer_id');
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit DROP unitRefId');
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER geom TYPE VARCHAR(255)');
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER unitName TYPE VARCHAR(255)');
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER unitName DROP DEFAULT');
|
|
||||||
$this->addSql('ALTER TABLE chill_main_geographical_unit ALTER unitName DROP NOT NULL');
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\Main;
|
namespace Chill\Migrations\Main;
|
||||||
@ -9,6 +16,13 @@ use Doctrine\Migrations\AbstractMigration;
|
|||||||
|
|
||||||
final class Version20221003132620 extends AbstractMigration
|
final class Version20221003132620 extends AbstractMigration
|
||||||
{
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('DROP INDEX geographical_unit_layer_refid');
|
||||||
|
$this->addSql('DROP INDEX geographical_unit_refid');
|
||||||
|
$this->addSql('DROP INDEX chill_internal_geographical_unit_layer_geom_idx');
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return 'Create indexes and unique constraints on geographical unit entities';
|
return 'Create indexes and unique constraints on geographical unit entities';
|
||||||
@ -20,11 +34,4 @@ final class Version20221003132620 extends AbstractMigration
|
|||||||
$this->addSql('CREATE UNIQUE INDEX geographical_unit_refid ON chill_main_geographical_unit (layer_id, unitRefId)');
|
$this->addSql('CREATE UNIQUE INDEX geographical_unit_refid ON chill_main_geographical_unit (layer_id, unitRefId)');
|
||||||
$this->addSql('CREATE INDEX chill_internal_geographical_unit_layer_geom_idx ON chill_main_geographical_unit USING GIST (layer_id, geom)');
|
$this->addSql('CREATE INDEX chill_internal_geographical_unit_layer_geom_idx ON chill_main_geographical_unit USING GIST (layer_id, geom)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('DROP INDEX geographical_unit_layer_refid');
|
|
||||||
$this->addSql('DROP INDEX geographical_unit_refid');
|
|
||||||
$this->addSql('DROP INDEX chill_internal_geographical_unit_layer_geom_idx');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ use libphonenumber\PhoneNumber;
|
|||||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
|
use UnexpectedValueException;
|
||||||
use function count;
|
use function count;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
|
|
||||||
@ -182,21 +183,23 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
* The person's center.
|
* The person's center.
|
||||||
*
|
*
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
|
||||||
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
private ?Center $center = null;
|
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")
|
* @ORM\OneToOne(targetEntity=PersonCenterCurrent::class, mappedBy="person")
|
||||||
*/
|
*/
|
||||||
private ?PersonCenterCurrent $centerCurrent = null;
|
private ?PersonCenterCurrent $centerCurrent = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity=PersonCenterHistory::class, mappedBy="person", cascade={"persist"})
|
||||||
|
*
|
||||||
|
* @var Collection|PersonCenterHistory[]
|
||||||
|
*/
|
||||||
|
private Collection $centerHistory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array where customfield's data are stored.
|
* Array where customfield's data are stored.
|
||||||
*
|
*
|
||||||
@ -910,32 +913,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
return $this->budgetResources;
|
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
|
public function getCenter(): ?Center
|
||||||
{
|
{
|
||||||
if (null !== $this->centerCurrent) {
|
if (null !== $this->centerCurrent) {
|
||||||
@ -949,6 +926,24 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
return $currentCenterHistory->getCenter();
|
return $currentCenterHistory->getCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCenterCurrent(): ?PersonCenterCurrent
|
||||||
|
{
|
||||||
|
if (null !== $this->centerCurrent) {
|
||||||
|
return $this->centerCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $currentCenterHistory = $this->getCurrentCenterHistory()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PersonCenterCurrent($currentCenterHistory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCenterHistory(): Collection
|
||||||
|
{
|
||||||
|
return $this->centerHistory;
|
||||||
|
}
|
||||||
|
|
||||||
public function getCFData(): ?array
|
public function getCFData(): ?array
|
||||||
{
|
{
|
||||||
if (null === $this->cFData) {
|
if (null === $this->cFData) {
|
||||||
@ -1562,7 +1557,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
/**
|
/**
|
||||||
* Associate the center with the person. The association start on 'now'.
|
* Associate the center with the person. The association start on 'now'.
|
||||||
*
|
*
|
||||||
* @param Center $center
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setCenter(Center $center): self
|
public function setCenter(Center $center): self
|
||||||
@ -1582,40 +1576,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getCenterHistory(): Collection
|
|
||||||
{
|
|
||||||
return $this->centerHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Collection $centerHistory
|
|
||||||
* @return Person
|
|
||||||
*/
|
|
||||||
public function setCenterHistory(Collection $centerHistory): Person
|
public function setCenterHistory(Collection $centerHistory): Person
|
||||||
{
|
{
|
||||||
$this->centerHistory = $centerHistory;
|
$this->centerHistory = $centerHistory;
|
||||||
|
|
||||||
return $this;
|
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
|
* @return Person
|
||||||
*/
|
*/
|
||||||
@ -1818,6 +1785,34 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This private function scan accompanyingPeriodParticipations Collection,
|
* This private function scan accompanyingPeriodParticipations Collection,
|
||||||
* searching for a given AccompanyingPeriod.
|
* searching for a given AccompanyingPeriod.
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
<?php
|
<?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\Entity\Person;
|
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\Center;
|
||||||
use Chill\MainBundle\Entity\User;
|
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use DateTimeInterface;
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,6 +28,16 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
*/
|
*/
|
||||||
class PersonCenterCurrent
|
class PersonCenterCurrent
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity=Center::class)
|
||||||
|
*/
|
||||||
|
private Center $center;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||||
|
*/
|
||||||
|
private ?DateTimeImmutable $endDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
@ -35,20 +49,10 @@ class PersonCenterCurrent
|
|||||||
*/
|
*/
|
||||||
private Person $person;
|
private Person $person;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=Center::class)
|
|
||||||
*/
|
|
||||||
private Center $center;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="date_immutable", nullable=false)
|
* @ORM\Column(type="date_immutable", nullable=false)
|
||||||
*/
|
*/
|
||||||
private \DateTimeImmutable $startDate;
|
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.
|
* Populate the properties person, center, start and end date from history.
|
||||||
@ -56,7 +60,6 @@ class PersonCenterCurrent
|
|||||||
* The creator and updatedby are not filled.
|
* The creator and updatedby are not filled.
|
||||||
*
|
*
|
||||||
* @internal Should not be instantied, unless inside Person entity
|
* @internal Should not be instantied, unless inside Person entity
|
||||||
* @param PersonCenterHistory $history
|
|
||||||
*/
|
*/
|
||||||
public function __construct(PersonCenterHistory $history)
|
public function __construct(PersonCenterHistory $history)
|
||||||
{
|
{
|
||||||
@ -67,46 +70,31 @@ class PersonCenterCurrent
|
|||||||
$this->id = $history->getId();
|
$this->id = $history->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCenter(): Center
|
||||||
|
{
|
||||||
|
return $this->center;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEndDate(): ?DateTimeImmutable
|
||||||
|
{
|
||||||
|
return $this->endDate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The id will be the same as the current @link{PersonCenterHistory::class}
|
* The id will be the same as the current @see{PersonCenterHistory::class}.
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function getId(): int
|
public function getId(): int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Person
|
|
||||||
*/
|
|
||||||
public function getPerson(): Person
|
public function getPerson(): Person
|
||||||
{
|
{
|
||||||
return $this->person;
|
return $this->person;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getStartDate(): DateTimeImmutable
|
||||||
* @return Center
|
|
||||||
*/
|
|
||||||
public function getCenter(): Center
|
|
||||||
{
|
|
||||||
return $this->center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \DateTimeImmutable
|
|
||||||
*/
|
|
||||||
public function getStartDate(): \DateTimeImmutable
|
|
||||||
{
|
{
|
||||||
return $this->startDate;
|
return $this->startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \DateTimeImmutable|null
|
|
||||||
*/
|
|
||||||
public function getEndDate(): ?\DateTimeImmutable
|
|
||||||
{
|
|
||||||
return $this->endDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\Entity\Person;
|
namespace Chill\PersonBundle\Entity\Person;
|
||||||
|
|
||||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||||
@ -8,10 +17,11 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
|||||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associate a Person with a Center. The association may change on date intervals
|
* Associate a Person with a Center. The association may change on date intervals.
|
||||||
*
|
*
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(name="chill_person_person_center_history")
|
* @ORM\Table(name="chill_person_person_center_history")
|
||||||
@ -19,8 +29,19 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterface
|
class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterface
|
||||||
{
|
{
|
||||||
use TrackCreationTrait;
|
use TrackCreationTrait;
|
||||||
|
|
||||||
use TrackUpdateTrait;
|
use TrackUpdateTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity=Center::class)
|
||||||
|
*/
|
||||||
|
private ?Center $center = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||||
|
*/
|
||||||
|
private ?DateTimeImmutable $endDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
@ -33,71 +54,43 @@ class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterfac
|
|||||||
*/
|
*/
|
||||||
private ?Person $person = null;
|
private ?Person $person = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity=Center::class)
|
|
||||||
*/
|
|
||||||
private ?Center $center = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="date_immutable", nullable=false)
|
* @ORM\Column(type="date_immutable", nullable=false)
|
||||||
*/
|
*/
|
||||||
private ?\DateTimeImmutable $startDate = null;
|
private ?DateTimeImmutable $startDate = null;
|
||||||
|
|
||||||
/**
|
public function __construct(?Person $person = null, ?Center $center = null, ?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->person = $person;
|
||||||
$this->center = $center;
|
$this->center = $center;
|
||||||
$this->startDate = $startDate;
|
$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
|
public function getCenter(): ?Center
|
||||||
{
|
{
|
||||||
return $this->center;
|
return $this->center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getEndDate(): ?DateTimeImmutable
|
||||||
* @param Center|null $center
|
{
|
||||||
*/
|
return $this->endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPerson(): ?Person
|
||||||
|
{
|
||||||
|
return $this->person;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStartDate(): ?DateTimeImmutable
|
||||||
|
{
|
||||||
|
return $this->startDate;
|
||||||
|
}
|
||||||
|
|
||||||
public function setCenter(?Center $center): self
|
public function setCenter(?Center $center): self
|
||||||
{
|
{
|
||||||
$this->center = $center;
|
$this->center = $center;
|
||||||
@ -105,38 +98,24 @@ class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterfac
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setEndDate(?DateTimeImmutable $endDate): self
|
||||||
* @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;
|
$this->endDate = $endDate;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setPerson(?Person $person): self
|
||||||
|
{
|
||||||
|
$this->person = $person;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStartDate(?DateTimeImmutable $startDate): self
|
||||||
|
{
|
||||||
|
$this->startDate = $startDate;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
class AdministrativeLocationAggregator implements AggregatorInterface
|
class AdministrativeLocationAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -13,11 +13,8 @@ namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
|
|||||||
|
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository;
|
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepositoryInterface;
|
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepositoryInterface;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@ -63,7 +60,7 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
|||||||
return 'Closing motive';
|
return 'Closing motive';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL === $value) {
|
if (null === $value) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\Export\Aggregator\AccompanyingCourseAggregators;
|
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
@ -11,12 +20,13 @@ use Chill\MainBundle\Repository\GeographicalUnitLayerRepositoryInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\EntityRepository;
|
|
||||||
use Doctrine\ORM\Query\Expr\Join;
|
use Doctrine\ORM\Query\Expr\Join;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use UnexpectedValueException;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class GeographicalUnitStatAggregator implements AggregatorInterface
|
final class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
@ -32,91 +42,11 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
|
|||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getLabels($key, array $values, $data)
|
|
||||||
{
|
|
||||||
switch ($key) {
|
|
||||||
case 'acp_geog_agg_unitname':
|
|
||||||
return function ($value): string {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return 'acp_geog_agg_unitname';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
};
|
|
||||||
case 'acp_geog_agg_unitrefid':
|
|
||||||
return function ($value): string {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return 'acp_geog_agg_unitrefid';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
};
|
|
||||||
default:
|
|
||||||
throw new \UnexpectedValueException('this value should not happens');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getQueryKeys($data): array
|
|
||||||
{
|
|
||||||
return ['acp_geog_agg_unitname', 'acp_geog_agg_unitrefid'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('date_calc', ChillDateType::class, [
|
|
||||||
'label' => 'Compute geographical location at date',
|
|
||||||
'required' => true,
|
|
||||||
'data' => new \DateTimeImmutable('today'),
|
|
||||||
'input' => 'datetime_immutable',
|
|
||||||
])
|
|
||||||
->add('level', EntityType::class, [
|
|
||||||
'label' => 'Geographical layer',
|
|
||||||
'placeholder' => 'Select a geographical layer',
|
|
||||||
'class' => GeographicalUnitLayer::class,
|
|
||||||
'choices' => $this->geographicalUnitLayerRepository->findAllHavingUnits(),
|
|
||||||
'choice_label' => function(GeographicalUnitLayer $item) {
|
|
||||||
return $this->translatableStringHelper->localize($item->getName());
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getTitle(): string
|
|
||||||
{
|
|
||||||
return 'Group by geographical unit';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acp_geog_agg_location_history', $qb->getAllAliases(), true)) {
|
if (!in_array('acp_geog_agg_location_history', $qb->getAllAliases(), true)) {
|
||||||
@ -181,15 +111,75 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
|
|||||||
->addSelect('acp_geog_units.unitName AS acp_geog_agg_unitname')
|
->addSelect('acp_geog_units.unitName AS acp_geog_agg_unitname')
|
||||||
->addSelect('acp_geog_units.unitRefId AS acp_geog_agg_unitrefid')
|
->addSelect('acp_geog_units.unitRefId AS acp_geog_agg_unitrefid')
|
||||||
->addGroupBy('acp_geog_agg_unitname')
|
->addGroupBy('acp_geog_agg_unitname')
|
||||||
->addGroupBy('acp_geog_agg_unitrefid')
|
->addGroupBy('acp_geog_agg_unitrefid');
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACP_TYPE;
|
return Declarations::ACP_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('date_calc', ChillDateType::class, [
|
||||||
|
'label' => 'Compute geographical location at date',
|
||||||
|
'required' => true,
|
||||||
|
'data' => new DateTimeImmutable('today'),
|
||||||
|
'input' => 'datetime_immutable',
|
||||||
|
])
|
||||||
|
->add('level', EntityType::class, [
|
||||||
|
'label' => 'Geographical layer',
|
||||||
|
'placeholder' => 'Select a geographical layer',
|
||||||
|
'class' => GeographicalUnitLayer::class,
|
||||||
|
'choices' => $this->geographicalUnitLayerRepository->findAllHavingUnits(),
|
||||||
|
'choice_label' => function (GeographicalUnitLayer $item) {
|
||||||
|
return $this->translatableStringHelper->localize($item->getName());
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabels($key, array $values, $data)
|
||||||
|
{
|
||||||
|
switch ($key) {
|
||||||
|
case 'acp_geog_agg_unitname':
|
||||||
|
return static function ($value): string {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'acp_geog_agg_unitname';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
};
|
||||||
|
|
||||||
|
case 'acp_geog_agg_unitrefid':
|
||||||
|
return static function ($value): string {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'acp_geog_agg_unitrefid';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new UnexpectedValueException('this value should not happens');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueryKeys($data): array
|
||||||
|
{
|
||||||
|
return ['acp_geog_agg_unitname', 'acp_geog_agg_unitrefid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(): string
|
||||||
|
{
|
||||||
|
return 'Group by geographical unit';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class JobAggregator implements AggregatorInterface
|
final class JobAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class OriginAggregator implements AggregatorInterface
|
final class OriginAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Templating\Entity\UserRender;
|
|||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class ReferrerAggregator implements AggregatorInterface
|
final class ReferrerAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -1,25 +1,34 @@
|
|||||||
<?php
|
<?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\Export\Aggregator\AccompanyingCourseAggregators;
|
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
|
||||||
|
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Repository\ScopeRepository;
|
|
||||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class ReferrerScopeAggregator implements AggregatorInterface
|
class ReferrerScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
private const SCOPE_KEY = 'acp_agg_refscope_user_history_ref_scope_name';
|
private const SCOPE_KEY = 'acp_agg_refscope_user_history_ref_scope_name';
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
private ScopeRepositoryInterface $scopeRepository;
|
||||||
|
|
||||||
|
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ScopeRepositoryInterface $scopeRepository,
|
ScopeRepositoryInterface $scopeRepository,
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
TranslatableStringHelperInterface $translatableStringHelper
|
||||||
@ -28,9 +37,56 @@ class ReferrerScopeAggregator implements AggregatorInterface
|
|||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function addRole(): ?string
|
||||||
* @inheritDoc
|
{
|
||||||
*/
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
|
{
|
||||||
|
$userHistory = 'acp_agg_refscope_user_history';
|
||||||
|
$ref = 'acp_agg_refscope_user_history_ref';
|
||||||
|
$scopeName = self::SCOPE_KEY;
|
||||||
|
$dateCalc = 'acp_agg_refscope_user_history_date_calc';
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->leftJoin('acp.userHistories', $userHistory)
|
||||||
|
->leftJoin($userHistory . '.user', $ref)
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->orX(
|
||||||
|
$qb->expr()->isNull($userHistory),
|
||||||
|
$qb->expr()->andX(
|
||||||
|
$qb->expr()->lte($userHistory . '.startDate', ':' . $dateCalc),
|
||||||
|
$qb->expr()->orX(
|
||||||
|
$qb->expr()->isNull($userHistory . '.endDate'),
|
||||||
|
$qb->expr()->lt($userHistory . '.endDate', ':' . $dateCalc)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter($dateCalc, $data['date_calc']);
|
||||||
|
|
||||||
|
// add groups
|
||||||
|
$qb
|
||||||
|
->addSelect('IDENTITY(' . $ref . '.mainScope) AS ' . $scopeName)
|
||||||
|
->addGroupBy($scopeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function applyOn()
|
||||||
|
{
|
||||||
|
return Declarations::ACP_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
$builder->add('date_calc', ChillDateType::class, [
|
||||||
|
'input' => 'datetime_immutable',
|
||||||
|
'data' => new DateTimeImmutable('now'),
|
||||||
|
'label' => 'export.aggregator.course.by_user_scope.Computation date for referrer',
|
||||||
|
'required' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
return function ($value) {
|
return function ($value) {
|
||||||
@ -45,89 +101,20 @@ class ReferrerScopeAggregator implements AggregatorInterface
|
|||||||
$scope = $this->scopeRepository->find($value);
|
$scope = $this->scopeRepository->find($value);
|
||||||
|
|
||||||
if (null === $scope) {
|
if (null === $scope) {
|
||||||
throw new \LogicException('no scope found with this id: ' . $value);
|
throw new LogicException('no scope found with this id: ' . $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($scope->getName());
|
return $this->translatableStringHelper->localize($scope->getName());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
{
|
{
|
||||||
return [self::SCOPE_KEY];
|
return [self::SCOPE_KEY];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
$builder->add('date_calc', ChillDateType::class, [
|
|
||||||
'input' => 'datetime_immutable',
|
|
||||||
'data' => new \DateTimeImmutable('now'),
|
|
||||||
'label' => 'export.aggregator.course.by_user_scope.Computation date for referrer',
|
|
||||||
'required' => true,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getTitle()
|
public function getTitle()
|
||||||
{
|
{
|
||||||
return 'export.aggregator.course.by_user_scope.Group course by referrer\'s scope';
|
return 'export.aggregator.course.by_user_scope.Group course by referrer\'s scope';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function addRole(): ?string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
|
||||||
{
|
|
||||||
$userHistory = 'acp_agg_refscope_user_history';
|
|
||||||
$ref = 'acp_agg_refscope_user_history_ref';
|
|
||||||
$scopeName = self::SCOPE_KEY;
|
|
||||||
$dateCalc = 'acp_agg_refscope_user_history_date_calc';
|
|
||||||
|
|
||||||
$qb
|
|
||||||
->leftJoin('acp.userHistories', $userHistory)
|
|
||||||
->leftJoin($userHistory.'.user', $ref)
|
|
||||||
->andWhere(
|
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull($userHistory),
|
|
||||||
$qb->expr()->andX(
|
|
||||||
$qb->expr()->lte($userHistory.'.startDate', ':'.$dateCalc),
|
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull($userHistory.'.endDate'),
|
|
||||||
$qb->expr()->lt($userHistory.'.endDate', ':'.$dateCalc)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->setParameter($dateCalc, $data['date_calc']);
|
|
||||||
|
|
||||||
// add groups
|
|
||||||
$qb
|
|
||||||
->addSelect('IDENTITY('.$ref.'.mainScope) AS '.$scopeName)
|
|
||||||
->addGroupBy($scopeName)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function applyOn()
|
|
||||||
{
|
|
||||||
return Declarations::ACP_TYPE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class ScopeAggregator implements AggregatorInterface
|
final class ScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
|||||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class SocialIssueAggregator implements AggregatorInterface
|
final class SocialIssueAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@ use Chill\PersonBundle\Export\Declarations;
|
|||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
@ -73,7 +72,7 @@ class ChildrenNumberAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return static function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Number of children';
|
return 'Number of children';
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepository;
|
|||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\Export\Aggregator\PersonAggregators;
|
namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\GeographicalUnit;
|
use Chill\MainBundle\Entity\GeographicalUnit;
|
||||||
@ -9,8 +18,10 @@ use Chill\MainBundle\Form\Type\ChillDateType;
|
|||||||
use Chill\MainBundle\Repository\GeographicalUnitLayerRepositoryInterface;
|
use Chill\MainBundle\Repository\GeographicalUnitLayerRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\Query\Expr\Join;
|
use Doctrine\ORM\Query\Expr\Join;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@ -28,93 +39,11 @@ class GeographicalUnitAggregator implements AggregatorInterface
|
|||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getLabels($key, array $values, $data)
|
|
||||||
{
|
|
||||||
switch ($key) {
|
|
||||||
case 'geog_unit_name':
|
|
||||||
return function ($value): string {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return 'acp_geog_agg_unitname';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
};
|
|
||||||
|
|
||||||
case 'geog_unit_key':
|
|
||||||
return function ($value): string {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return 'acp_geog_agg_unitrefid';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
};
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new \LogicException('key not supported');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getQueryKeys($data)
|
|
||||||
{
|
|
||||||
return ['geog_unit_name', 'geog_unit_key'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('date_calc', ChillDateType::class, [
|
|
||||||
'label' => 'Address valid at this date',
|
|
||||||
'required' => true,
|
|
||||||
'data' => new \DateTimeImmutable('today'),
|
|
||||||
'input' => 'datetime_immutable',
|
|
||||||
])
|
|
||||||
->add('level', EntityType::class, [
|
|
||||||
'label' => 'Geographical layer',
|
|
||||||
'placeholder' => 'Select a geographical layer',
|
|
||||||
'class' => GeographicalUnitLayer::class,
|
|
||||||
'choices' => $this->geographicalUnitLayerRepository->findAllHavingUnits(),
|
|
||||||
'choice_label' => function(GeographicalUnitLayer $item) {
|
|
||||||
return $this->translatableStringHelper->localize($item->getName());
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getTitle()
|
|
||||||
{
|
|
||||||
return 'Group people by geographical unit based on his address';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data): void
|
public function alterQuery(QueryBuilder $qb, $data): void
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
@ -144,20 +73,80 @@ class GeographicalUnitAggregator implements AggregatorInterface
|
|||||||
->addSelect('person_geog_agg_geog_unit.unitName AS geog_unit_name')
|
->addSelect('person_geog_agg_geog_unit.unitName AS geog_unit_name')
|
||||||
->addSelect('person_geog_agg_geog_unit.unitRefId AS geog_unit_key')
|
->addSelect('person_geog_agg_geog_unit.unitRefId AS geog_unit_key')
|
||||||
->addGroupBy('geog_unit_name')
|
->addGroupBy('geog_unit_name')
|
||||||
->addGroupBy('geog_unit_key')
|
->addGroupBy('geog_unit_key');
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function applyOn()
|
public function applyOn()
|
||||||
{
|
{
|
||||||
return Declarations::PERSON_TYPE;
|
return Declarations::PERSON_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('date_calc', ChillDateType::class, [
|
||||||
|
'label' => 'Address valid at this date',
|
||||||
|
'required' => true,
|
||||||
|
'data' => new DateTimeImmutable('today'),
|
||||||
|
'input' => 'datetime_immutable',
|
||||||
|
])
|
||||||
|
->add('level', EntityType::class, [
|
||||||
|
'label' => 'Geographical layer',
|
||||||
|
'placeholder' => 'Select a geographical layer',
|
||||||
|
'class' => GeographicalUnitLayer::class,
|
||||||
|
'choices' => $this->geographicalUnitLayerRepository->findAllHavingUnits(),
|
||||||
|
'choice_label' => function (GeographicalUnitLayer $item) {
|
||||||
|
return $this->translatableStringHelper->localize($item->getName());
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public static function getDefaultAlias(): string
|
public static function getDefaultAlias(): string
|
||||||
{
|
{
|
||||||
return 'person_geog_agg';
|
return 'person_geog_agg';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLabels($key, array $values, $data)
|
||||||
|
{
|
||||||
|
switch ($key) {
|
||||||
|
case 'geog_unit_name':
|
||||||
|
return static function ($value): string {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'acp_geog_agg_unitname';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
};
|
||||||
|
|
||||||
|
case 'geog_unit_key':
|
||||||
|
return static function ($value): string {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'acp_geog_agg_unitrefid';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new LogicException('key not supported');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueryKeys($data)
|
||||||
|
{
|
||||||
|
return ['geog_unit_name', 'geog_unit_key'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle()
|
||||||
|
{
|
||||||
|
return 'Group people by geographical unit based on his address';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
final class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use Chill\PersonBundle\Export\Declarations;
|
|||||||
use Chill\PersonBundle\Repository\MaritalStatusRepository;
|
use Chill\PersonBundle\Repository\MaritalStatusRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class MaritalStatusAggregator implements AggregatorInterface
|
final class MaritalStatusAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
|||||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class ActionTypeAggregator implements AggregatorInterface
|
final class ActionTypeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use Chill\PersonBundle\Export\Declarations;
|
|||||||
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class GoalAggregator implements AggregatorInterface
|
final class GoalAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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\Export\Aggregator\SocialWorkAggregators;
|
namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators;
|
||||||
|
|
||||||
use Chill\MainBundle\Export\AggregatorInterface;
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
@ -8,14 +17,16 @@ use Chill\PersonBundle\Export\Declarations;
|
|||||||
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
|
||||||
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use LogicException;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
class GoalResultAggregator implements AggregatorInterface
|
class GoalResultAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private ResultRepository $resultRepository;
|
|
||||||
|
|
||||||
private GoalRepository $goalRepository;
|
private GoalRepository $goalRepository;
|
||||||
|
|
||||||
|
private ResultRepository $resultRepository;
|
||||||
|
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@ -28,86 +39,11 @@ class GoalResultAggregator implements AggregatorInterface
|
|||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$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
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
||||||
@ -123,11 +59,62 @@ class GoalResultAggregator implements AggregatorInterface
|
|||||||
$qb->addGroupBy('goal_aggregator')->addGroupBy('result_aggregator');
|
$qb->addGroupBy('goal_aggregator')->addGroupBy('result_aggregator');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
// no form
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueryKeys($data): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'goal_aggregator',
|
||||||
|
'result_aggregator',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(): string
|
||||||
|
{
|
||||||
|
return 'Group social work actions by goal and result';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class JobAggregator implements AggregatorInterface
|
final class JobAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Templating\Entity\UserRender;
|
|||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class ReferrerAggregator implements AggregatorInterface
|
final class ReferrerAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use Chill\PersonBundle\Export\Declarations;
|
|||||||
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class ResultAggregator implements AggregatorInterface
|
final class ResultAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
final class ScopeAggregator implements AggregatorInterface
|
final class ScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user