mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
@@ -24,24 +24,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class PersonAddressMoveEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private EngineInterface $engine;
|
||||
|
||||
private NotificationPersisterInterface $notificationPersister;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
EngineInterface $engine,
|
||||
NotificationPersisterInterface $notificationPersister,
|
||||
Security $security,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->engine = $engine;
|
||||
$this->notificationPersister = $notificationPersister;
|
||||
$this->security = $security;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private EngineInterface $engine, private NotificationPersisterInterface $notificationPersister, private Security $security, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
|
@@ -24,20 +24,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class UserRefEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private EngineInterface $engine;
|
||||
|
||||
private NotificationPersisterInterface $notificationPersister;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(Security $security, TranslatorInterface $translator, EngineInterface $engine, NotificationPersisterInterface $notificationPersister)
|
||||
public function __construct(private Security $security, private TranslatorInterface $translator, private EngineInterface $engine, private NotificationPersisterInterface $notificationPersister)
|
||||
{
|
||||
$this->security = $security;
|
||||
$this->translator = $translator;
|
||||
$this->engine = $engine;
|
||||
$this->notificationPersister = $notificationPersister;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
|
@@ -22,25 +22,6 @@ class ActionEvent extends Event
|
||||
|
||||
public const MOVE = 'CHILL_PERSON.MOVE_ASSOCIATED_ENTITY';
|
||||
|
||||
/**
|
||||
* the FQDN class name as recorded in doctrine.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $entity;
|
||||
|
||||
/**
|
||||
* an array of key value data to describe the movement.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $personId;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
@@ -52,18 +33,26 @@ class ActionEvent extends Event
|
||||
protected $preSql = [];
|
||||
|
||||
/**
|
||||
* the sql statement.
|
||||
*
|
||||
* @var string
|
||||
* @param string $entity
|
||||
* @param mixed[] $metadata
|
||||
* @param int $personId
|
||||
* @param string $sqlStatement
|
||||
*/
|
||||
protected $sqlStatement;
|
||||
|
||||
public function __construct($personId, $entity, $sqlStatement, $metadata = [])
|
||||
{
|
||||
$this->personId = $personId;
|
||||
$this->entity = $entity;
|
||||
$this->sqlStatement = $sqlStatement;
|
||||
$this->metadata = $metadata;
|
||||
public function __construct(
|
||||
protected $personId,
|
||||
/**
|
||||
* the FQDN class name as recorded in doctrine.
|
||||
*/
|
||||
protected $entity,
|
||||
/**
|
||||
* the sql statement.
|
||||
*/
|
||||
protected $sqlStatement,
|
||||
/**
|
||||
* an array of key value data to describe the movement.
|
||||
*/
|
||||
protected $metadata = []
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -131,25 +131,14 @@ class EntityPersonCRUDController extends CRUDController
|
||||
return $this->getActionConfig($action)['template'];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'new':
|
||||
return '@ChillPerson/CRUD/new.html.twig';
|
||||
|
||||
case 'edit':
|
||||
return '@ChillPerson/CRUD/edit.html.twig';
|
||||
|
||||
case 'view':
|
||||
return '@ChillPerson/CRUD/view.html.twig';
|
||||
|
||||
case 'delete':
|
||||
return '@ChillPerson/CRUD/delete.html.twig';
|
||||
|
||||
case 'index':
|
||||
return '@ChillPerson/CRUD/index.html.twig';
|
||||
|
||||
default:
|
||||
return parent::getTemplateFor($action, $entity, $request);
|
||||
}
|
||||
return match ($action) {
|
||||
'new' => '@ChillPerson/CRUD/new.html.twig',
|
||||
'edit' => '@ChillPerson/CRUD/edit.html.twig',
|
||||
'view' => '@ChillPerson/CRUD/view.html.twig',
|
||||
'delete' => '@ChillPerson/CRUD/delete.html.twig',
|
||||
'index' => '@ChillPerson/CRUD/index.html.twig',
|
||||
default => parent::getTemplateFor($action, $entity, $request),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,28 +150,21 @@ class EntityPersonCRUDController extends CRUDController
|
||||
{
|
||||
$next = $request->request->get('submit', 'save-and-close');
|
||||
|
||||
switch ($next) {
|
||||
case 'save-and-close':
|
||||
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index', [
|
||||
'person_id' => $this->getPerson($request)->getId(),
|
||||
]);
|
||||
|
||||
case 'save-and-new':
|
||||
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_new', [
|
||||
'person_id' => $this->getPerson($request)->getId(),
|
||||
]);
|
||||
|
||||
case 'new':
|
||||
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [
|
||||
'id' => $entity->getId(),
|
||||
'person_id' => $this->getPerson($request)->getId(),
|
||||
]);
|
||||
|
||||
default:
|
||||
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [
|
||||
'id' => $entity->getId(),
|
||||
'person_id' => $this->getPerson($request)->getId(),
|
||||
]);
|
||||
}
|
||||
return match ($next) {
|
||||
'save-and-close' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index', [
|
||||
'person_id' => $this->getPerson($request)->getId(),
|
||||
]),
|
||||
'save-and-new' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_new', [
|
||||
'person_id' => $this->getPerson($request)->getId(),
|
||||
]),
|
||||
'new' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [
|
||||
'id' => $entity->getId(),
|
||||
'person_id' => $this->getPerson($request)->getId(),
|
||||
]),
|
||||
default => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [
|
||||
'id' => $entity->getId(),
|
||||
'person_id' => $this->getPerson($request)->getId(),
|
||||
]),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -50,21 +50,14 @@ class OneToOneEntityPersonCRUDController extends CRUDController
|
||||
return $this->crudConfig[$action]['template'];
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'new':
|
||||
return '@ChillPerson/CRUD/new.html.twig';
|
||||
|
||||
case 'edit':
|
||||
return '@ChillPerson/CRUD/edit.html.twig';
|
||||
|
||||
case 'index':
|
||||
return '@ChillPerson/CRUD/index.html.twig';
|
||||
|
||||
default:
|
||||
throw new LogicException("the view for action {$action} is not "
|
||||
. 'defined. You should override ' . __METHOD__ . ' to add this '
|
||||
. 'action');
|
||||
}
|
||||
return match ($action) {
|
||||
'new' => '@ChillPerson/CRUD/new.html.twig',
|
||||
'edit' => '@ChillPerson/CRUD/edit.html.twig',
|
||||
'index' => '@ChillPerson/CRUD/index.html.twig',
|
||||
default => throw new LogicException("the view for action {$action} is not "
|
||||
. 'defined. You should override ' . __METHOD__ . ' to add this '
|
||||
. 'action'),
|
||||
};
|
||||
}
|
||||
|
||||
protected function onPostFetchEntity($action, Request $request, $entity): ?Response
|
||||
|
@@ -25,22 +25,12 @@ use function ctype_digit;
|
||||
|
||||
final class ChillPersonMoveCommand extends Command
|
||||
{
|
||||
private LoggerInterface $chillLogger;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private PersonMove $mover;
|
||||
|
||||
public function __construct(
|
||||
PersonMove $mover,
|
||||
EntityManagerInterface $em,
|
||||
LoggerInterface $chillLogger
|
||||
private PersonMove $mover,
|
||||
private EntityManagerInterface $em,
|
||||
private LoggerInterface $chillLogger
|
||||
) {
|
||||
parent::__construct('chill:person:move');
|
||||
|
||||
$this->mover = $mover;
|
||||
$this->em = $em;
|
||||
$this->chillLogger = $chillLogger;
|
||||
}
|
||||
|
||||
protected function buildLoggingContext(Person $from, Person $to, $deleteEntities, $sqls)
|
||||
|
@@ -27,17 +27,10 @@ final class ImportSocialWorkMetadata extends Command
|
||||
{
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected ChillImporter $importer;
|
||||
|
||||
public function __construct(
|
||||
SocialWorkMetadataInterface $socialWorkMetadata
|
||||
protected SocialWorkMetadataInterface $importer
|
||||
) {
|
||||
parent::__construct('chill:person:import-socialwork');
|
||||
|
||||
$this->importer = $socialWorkMetadata;
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
|
@@ -22,16 +22,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class RemoveOldDraftAccompanyingPeriodCommand extends Command
|
||||
{
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private OldDraftAccompanyingPeriodRemoverInterface $remover;
|
||||
|
||||
public function __construct(LoggerInterface $logger, OldDraftAccompanyingPeriodRemoverInterface $remover)
|
||||
public function __construct(private LoggerInterface $logger, private OldDraftAccompanyingPeriodRemoverInterface $remover)
|
||||
{
|
||||
parent::__construct('chill:person:remove-old-draft-period');
|
||||
|
||||
$this->logger = $logger;
|
||||
$this->remover = $remover;
|
||||
}
|
||||
|
||||
protected function configure(): void
|
||||
|
@@ -17,15 +17,14 @@ namespace Chill\PersonBundle\Config;
|
||||
class ConfigPersonAltNamesHelper
|
||||
{
|
||||
/**
|
||||
* the raw config, directly from the container parameter.
|
||||
*
|
||||
* @var array
|
||||
* @param mixed[] $config
|
||||
*/
|
||||
private $config = [];
|
||||
|
||||
public function __construct($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
public function __construct(
|
||||
/**
|
||||
* the raw config, directly from the container parameter.
|
||||
*/
|
||||
private $config
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -51,32 +51,8 @@ use function count;
|
||||
|
||||
final class AccompanyingCourseApiController extends ApiController
|
||||
{
|
||||
private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository;
|
||||
|
||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
||||
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
private ReferralsSuggestionInterface $referralAvailable;
|
||||
|
||||
private Registry $registry;
|
||||
|
||||
private ValidatorInterface $validator;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||
AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
ReferralsSuggestionInterface $referralAvailable,
|
||||
Registry $registry,
|
||||
ValidatorInterface $validator
|
||||
) {
|
||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
||||
$this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->referralAvailable = $referralAvailable;
|
||||
$this->registry = $registry;
|
||||
$this->validator = $validator;
|
||||
public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private EventDispatcherInterface $eventDispatcher, private ReferralsSuggestionInterface $referralAvailable, private Registry $registry, private ValidatorInterface $validator)
|
||||
{
|
||||
}
|
||||
|
||||
public function commentApi($id, Request $request, string $_format): Response
|
||||
@@ -190,20 +166,11 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
//
|
||||
$this->onPostCheckACL('participation', $request, $_format, $accompanyingPeriod);
|
||||
|
||||
switch ($request->getMethod()) {
|
||||
case Request::METHOD_POST:
|
||||
$participation = $accompanyingPeriod->createParticipationFor($person);
|
||||
|
||||
break;
|
||||
|
||||
case Request::METHOD_DELETE:
|
||||
$participation = $accompanyingPeriod->closeParticipationFor($person);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new BadRequestHttpException('This method is not supported');
|
||||
}
|
||||
$participation = match ($request->getMethod()) {
|
||||
Request::METHOD_POST => $accompanyingPeriod->createParticipationFor($person),
|
||||
Request::METHOD_DELETE => $accompanyingPeriod->closeParticipationFor($person),
|
||||
default => throw new BadRequestHttpException('This method is not supported'),
|
||||
};
|
||||
|
||||
$errors = $this->validator->validate($accompanyingPeriod);
|
||||
|
||||
@@ -320,10 +287,8 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
/**
|
||||
* @Route("/api/1.0/person/accompanying-course/{id}/confidential.json", name="chill_api_person_accompanying_period_confidential")
|
||||
* @ParamConverter("accompanyingCourse", options={"id": "id"})
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, $id, Request $request)
|
||||
public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, mixed $id, Request $request)
|
||||
{
|
||||
if ($request->getMethod() === 'POST') {
|
||||
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::TOGGLE_CONFIDENTIAL, $accompanyingCourse);
|
||||
|
@@ -32,20 +32,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class AccompanyingCourseCommentController extends AbstractController
|
||||
{
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private FormFactoryInterface $formFactory;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $entityManager,
|
||||
FormFactoryInterface $formFactory,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->formFactory = $formFactory;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private EntityManagerInterface $entityManager, private FormFactoryInterface $formFactory, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -41,32 +41,8 @@ use function is_array;
|
||||
*/
|
||||
class AccompanyingCourseController extends Controller
|
||||
{
|
||||
protected EventDispatcherInterface $dispatcher;
|
||||
|
||||
protected SerializerInterface $serializer;
|
||||
|
||||
protected ValidatorInterface $validator;
|
||||
|
||||
private Registry $registry;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
private AccompanyingPeriodWorkRepository $workRepository;
|
||||
|
||||
public function __construct(
|
||||
SerializerInterface $serializer,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
ValidatorInterface $validator,
|
||||
AccompanyingPeriodWorkRepository $workRepository,
|
||||
Registry $registry,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->serializer = $serializer;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->validator = $validator;
|
||||
$this->workRepository = $workRepository;
|
||||
$this->registry = $registry;
|
||||
$this->translator = $translator;
|
||||
public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private AccompanyingPeriodWorkRepository $workRepository, private Registry $registry, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -23,11 +23,8 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AccompanyingCourseWorkApiController extends ApiController
|
||||
{
|
||||
private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository;
|
||||
|
||||
public function __construct(AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository)
|
||||
public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository)
|
||||
{
|
||||
$this->accompanyingPeriodWorkRepository = $accompanyingPeriodWorkRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -28,28 +28,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class AccompanyingCourseWorkController extends AbstractController
|
||||
{
|
||||
private LoggerInterface $chillLogger;
|
||||
|
||||
private PaginatorFactory $paginator;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
private TranslatorInterface $trans;
|
||||
|
||||
private AccompanyingPeriodWorkRepository $workRepository;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $trans,
|
||||
SerializerInterface $serializer,
|
||||
AccompanyingPeriodWorkRepository $workRepository,
|
||||
PaginatorFactory $paginator,
|
||||
LoggerInterface $chillLogger
|
||||
) {
|
||||
$this->trans = $trans;
|
||||
$this->serializer = $serializer;
|
||||
$this->workRepository = $workRepository;
|
||||
$this->paginator = $paginator;
|
||||
$this->chillLogger = $chillLogger;
|
||||
public function __construct(private TranslatorInterface $trans, private SerializerInterface $serializer, private AccompanyingPeriodWorkRepository $workRepository, private PaginatorFactory $paginator, private LoggerInterface $chillLogger)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -36,8 +36,6 @@ use function count;
|
||||
*/
|
||||
class AccompanyingPeriodController extends AbstractController
|
||||
{
|
||||
protected AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository;
|
||||
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
@@ -49,11 +47,10 @@ class AccompanyingPeriodController extends AbstractController
|
||||
protected $validator;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository,
|
||||
protected AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
ValidatorInterface $validator
|
||||
) {
|
||||
$this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
@@ -32,26 +32,8 @@ use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
class AccompanyingPeriodRegulationListController
|
||||
{
|
||||
private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository;
|
||||
|
||||
private EngineInterface $engine;
|
||||
|
||||
private FormFactoryInterface $formFactory;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, EngineInterface $engine, FormFactoryInterface $formFactory, PaginatorFactory $paginatorFactory, Security $security, TranslatableStringHelperInterface $translatableStringHelper)
|
||||
public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private EngineInterface $engine, private FormFactoryInterface $formFactory, private PaginatorFactory $paginatorFactory, private Security $security, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
$this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository;
|
||||
$this->engine = $engine;
|
||||
$this->formFactory = $formFactory;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->security = $security;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -32,28 +32,8 @@ use function in_array;
|
||||
|
||||
class AccompanyingPeriodWorkEvaluationApiController
|
||||
{
|
||||
private AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository;
|
||||
|
||||
private DocGeneratorTemplateRepository $docGeneratorTemplateRepository;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository,
|
||||
DocGeneratorTemplateRepository $docGeneratorTemplateRepository,
|
||||
SerializerInterface $serializer,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
Security $security
|
||||
) {
|
||||
$this->accompanyingPeriodWorkEvaluationRepository = $accompanyingPeriodWorkEvaluationRepository;
|
||||
$this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository;
|
||||
$this->serializer = $serializer;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->security = $security;
|
||||
public function __construct(private AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private SerializerInterface $serializer, private PaginatorFactory $paginatorFactory, private Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -35,20 +35,8 @@ use function array_values;
|
||||
|
||||
class HouseholdApiController extends ApiController
|
||||
{
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
private HouseholdACLAwareRepositoryInterface $householdACLAwareRepository;
|
||||
|
||||
private HouseholdRepository $householdRepository;
|
||||
|
||||
public function __construct(
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
HouseholdRepository $householdRepository,
|
||||
HouseholdACLAwareRepositoryInterface $householdACLAwareRepository
|
||||
) {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->householdRepository = $householdRepository;
|
||||
$this->householdACLAwareRepository = $householdACLAwareRepository;
|
||||
public function __construct(private EventDispatcherInterface $eventDispatcher, private HouseholdRepository $householdRepository, private HouseholdACLAwareRepositoryInterface $householdACLAwareRepository)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -36,53 +36,14 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class HouseholdCompositionController extends AbstractController
|
||||
{
|
||||
private EngineInterface $engine;
|
||||
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private FormFactoryInterface $formFactory;
|
||||
|
||||
private HouseholdCompositionRepository $householdCompositionRepository;
|
||||
|
||||
private HouseholdRepository $householdRepository;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
private UrlGeneratorInterface $urlGenerator;
|
||||
|
||||
public function __construct(
|
||||
Security $security,
|
||||
HouseholdCompositionRepository $householdCompositionRepository,
|
||||
HouseholdRepository $householdRepository,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
FormFactoryInterface $formFactory,
|
||||
EntityManagerInterface $entityManager,
|
||||
TranslatorInterface $translator,
|
||||
EngineInterface $engine,
|
||||
UrlGeneratorInterface $urlGenerator
|
||||
) {
|
||||
$this->security = $security;
|
||||
$this->householdCompositionRepository = $householdCompositionRepository;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->formFactory = $formFactory;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->translator = $translator;
|
||||
$this->engine = $engine;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->householdRepository = $householdRepository;
|
||||
public function __construct(private Security $security, private HouseholdCompositionRepository $householdCompositionRepository, private HouseholdRepository $householdRepository, private PaginatorFactory $paginatorFactory, private FormFactoryInterface $formFactory, private EntityManagerInterface $entityManager, private TranslatorInterface $translator, private EngineInterface $engine, private UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete")
|
||||
*
|
||||
* @param mixed $household_id
|
||||
* @param mixed $composition_id
|
||||
*/
|
||||
public function deleteAction(Request $request, $household_id, $composition_id): Response
|
||||
public function deleteAction(Request $request, mixed $household_id, mixed $composition_id): Response
|
||||
{
|
||||
$composition = $this->householdCompositionRepository->find($composition_id);
|
||||
$household = $this->householdRepository->find($household_id);
|
||||
|
@@ -23,14 +23,9 @@ class HouseholdCompositionTypeApiController extends ApiController
|
||||
*/
|
||||
protected function customizeQuery(string $action, Request $request, $query): void
|
||||
{
|
||||
switch ($action) {
|
||||
case '_index':
|
||||
$query->andWhere($query->expr()->eq('e.active', "'TRUE'"));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UnexpectedValueException('unexepcted action: ' . $action);
|
||||
}
|
||||
match ($action) {
|
||||
'_index' => $query->andWhere($query->expr()->eq('e.active', "'TRUE'")),
|
||||
default => throw new UnexpectedValueException('unexepcted action: ' . $action),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -37,24 +37,8 @@ use function count;
|
||||
*/
|
||||
class HouseholdController extends AbstractController
|
||||
{
|
||||
private PositionRepository $positionRepository;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
PositionRepository $positionRepository,
|
||||
SerializerInterface $serializer,
|
||||
Security $security
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->positionRepository = $positionRepository;
|
||||
$this->serializer = $serializer;
|
||||
$this->security = $security;
|
||||
public function __construct(private TranslatorInterface $translator, private PositionRepository $positionRepository, private SerializerInterface $serializer, private Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -32,20 +32,8 @@ use function count;
|
||||
|
||||
class HouseholdMemberController extends ApiController
|
||||
{
|
||||
private UrlGeneratorInterface $generator;
|
||||
|
||||
private AccompanyingPeriodRepository $periodRepository;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
UrlGeneratorInterface $generator,
|
||||
TranslatorInterface $translator,
|
||||
AccompanyingPeriodRepository $periodRepository
|
||||
) {
|
||||
$this->generator = $generator;
|
||||
$this->translator = $translator;
|
||||
$this->periodRepository = $periodRepository;
|
||||
public function __construct(private UrlGeneratorInterface $generator, private TranslatorInterface $translator, private AccompanyingPeriodRepository $periodRepository)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,10 +163,8 @@ class HouseholdMemberController extends ApiController
|
||||
* "/api/1.0/person/household/members/move.{_format}",
|
||||
* name="chill_api_person_household_members_move"
|
||||
* )
|
||||
*
|
||||
* @param mixed $_format
|
||||
*/
|
||||
public function move(Request $request, $_format): Response
|
||||
public function move(Request $request, mixed $_format): Response
|
||||
{
|
||||
try {
|
||||
/** @var MembersEditor $editor */
|
||||
|
@@ -287,8 +287,6 @@ class PersonAddressController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Chill\PersonBundle\Entity\Person $person
|
||||
*
|
||||
* @return \Symfony\Component\Validator\ConstraintViolationListInterface
|
||||
*/
|
||||
private function validatePerson(Person $person)
|
||||
|
@@ -27,19 +27,13 @@ use function in_array;
|
||||
|
||||
class PersonApiController extends ApiController
|
||||
{
|
||||
private AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation;
|
||||
|
||||
private ConfigPersonAltNamesHelper $configPersonAltNameHelper;
|
||||
|
||||
private bool $showCenters;
|
||||
|
||||
public function __construct(
|
||||
AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation,
|
||||
ConfigPersonAltNamesHelper $configPersonAltNameHelper,
|
||||
private AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation,
|
||||
private ConfigPersonAltNamesHelper $configPersonAltNameHelper,
|
||||
ParameterBagInterface $parameterBag
|
||||
) {
|
||||
$this->authorizedCenterOnPersonCreation = $authorizedCenterOnPersonCreation;
|
||||
$this->configPersonAltNameHelper = $configPersonAltNameHelper;
|
||||
$this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers'];
|
||||
}
|
||||
|
||||
|
@@ -47,68 +47,20 @@ use function is_array;
|
||||
|
||||
final class PersonController extends AbstractController
|
||||
{
|
||||
private AuthorizationHelperInterface $authorizationHelper;
|
||||
|
||||
/**
|
||||
* @var ConfigPersonAltNamesHelper
|
||||
*/
|
||||
protected $configPersonAltNameHelper;
|
||||
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
/**
|
||||
* @var PersonRepository;
|
||||
*/
|
||||
protected $personRepository;
|
||||
|
||||
/**
|
||||
* @var SimilarPersonMatcher
|
||||
*/
|
||||
protected $similarPersonMatcher;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @var ValidatorInterface
|
||||
*/
|
||||
private $validator;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationHelperInterface $authorizationHelper,
|
||||
SimilarPersonMatcher $similarPersonMatcher,
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
PersonRepository $personRepository,
|
||||
ConfigPersonAltNamesHelper $configPersonAltNameHelper,
|
||||
LoggerInterface $logger,
|
||||
ValidatorInterface $validator,
|
||||
EntityManagerInterface $em,
|
||||
private AuthorizationHelperInterface $authorizationHelper,
|
||||
protected SimilarPersonMatcher $similarPersonMatcher,
|
||||
protected TranslatorInterface $translator,
|
||||
protected EventDispatcherInterface $eventDispatcher,
|
||||
/**
|
||||
* @var PersonRepository;
|
||||
*/
|
||||
protected PersonRepository $personRepository,
|
||||
protected ConfigPersonAltNamesHelper $configPersonAltNameHelper,
|
||||
private LoggerInterface $logger,
|
||||
private ValidatorInterface $validator,
|
||||
private EntityManagerInterface $em
|
||||
) {
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
||||
$this->translator = $translator;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->configPersonAltNameHelper = $configPersonAltNameHelper;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->logger = $logger;
|
||||
$this->validator = $validator;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function editAction($person_id, Request $request)
|
||||
@@ -335,11 +287,10 @@ final class PersonController extends AbstractController
|
||||
/**
|
||||
* easy getting a person by his id.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return \Chill\PersonBundle\Entity\Person
|
||||
*/
|
||||
private function _getPerson($id)
|
||||
private function _getPerson(mixed $id)
|
||||
{
|
||||
return $this->personRepository->find($id);
|
||||
}
|
||||
|
@@ -34,43 +34,8 @@ use function count;
|
||||
|
||||
class PersonDuplicateController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
|
||||
*/
|
||||
private $eventDispatcher;
|
||||
|
||||
/**
|
||||
* @var \Chill\PersonBundle\Actions\Remove\PersonMove
|
||||
*/
|
||||
private $personMove;
|
||||
|
||||
/**
|
||||
* @var \Chill\PersonBundle\Repository\PersonRepository
|
||||
*/
|
||||
private $personRepository;
|
||||
|
||||
/**
|
||||
* @var \Chill\PersonBundle\Search\SimilarPersonMatcher
|
||||
*/
|
||||
private $similarPersonMatcher;
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\Translation\TranslatorInterface
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(
|
||||
SimilarPersonMatcher $similarPersonMatcher,
|
||||
TranslatorInterface $translator,
|
||||
PersonRepository $personRepository,
|
||||
PersonMove $personMove,
|
||||
EventDispatcherInterface $eventDispatcher
|
||||
) {
|
||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
||||
$this->translator = $translator;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->personMove = $personMove;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
public function __construct(private SimilarPersonMatcher $similarPersonMatcher, private TranslatorInterface $translator, private PersonRepository $personRepository, private PersonMove $personMove, private EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
public function confirmAction($person1_id, $person2_id, Request $request)
|
||||
@@ -279,10 +244,8 @@ class PersonDuplicateController extends Controller
|
||||
|
||||
/**
|
||||
* easy getting a person by his id.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
private function _getPerson($id): ?Person
|
||||
private function _getPerson(mixed $id): ?Person
|
||||
{
|
||||
return $this->personRepository->find($id);
|
||||
}
|
||||
|
@@ -25,24 +25,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class PersonResourceController extends AbstractController
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private PersonResourceRepository $personResourceRepository;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
PersonResourceRepository $personResourceRepository,
|
||||
PersonRepository $personRepository,
|
||||
EntityManagerInterface $em,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->personResourceRepository = $personResourceRepository;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->em = $em;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private PersonResourceRepository $personResourceRepository, private PersonRepository $personRepository, private EntityManagerInterface $em, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function deleteAction(Request $request, $person_id, $resource_id): Response
|
||||
|
@@ -40,44 +40,8 @@ use function is_int;
|
||||
|
||||
class ReassignAccompanyingPeriodController extends AbstractController
|
||||
{
|
||||
private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository;
|
||||
|
||||
private AccompanyingPeriodRepository $courseRepository;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private EngineInterface $engine;
|
||||
|
||||
private FormFactoryInterface $formFactory;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository,
|
||||
UserRepository $userRepository,
|
||||
AccompanyingPeriodRepository $courseRepository,
|
||||
EngineInterface $engine,
|
||||
FormFactoryInterface $formFactory,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
Security $security,
|
||||
UserRender $userRender,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository;
|
||||
$this->engine = $engine;
|
||||
$this->formFactory = $formFactory;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->security = $security;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
$this->courseRepository = $courseRepository;
|
||||
$this->em = $em;
|
||||
public function __construct(private AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private UserRepository $userRepository, private AccompanyingPeriodRepository $courseRepository, private EngineInterface $engine, private FormFactoryInterface $formFactory, private PaginatorFactory $paginatorFactory, private Security $security, private UserRender $userRender, private EntityManagerInterface $em)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,14 +21,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class RelationshipApiController extends ApiController
|
||||
{
|
||||
private RelationshipRepository $repository;
|
||||
|
||||
private ValidatorInterface $validator;
|
||||
|
||||
public function __construct(ValidatorInterface $validator, RelationshipRepository $repository)
|
||||
public function __construct(private ValidatorInterface $validator, private RelationshipRepository $repository)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,20 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class ResidentialAddressController extends AbstractController
|
||||
{
|
||||
private UrlGeneratorInterface $generator;
|
||||
|
||||
private ResidentialAddressRepository $residentialAddressRepository;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
UrlGeneratorInterface $generator,
|
||||
TranslatorInterface $translator,
|
||||
ResidentialAddressRepository $residentialAddressRepository
|
||||
) {
|
||||
$this->generator = $generator;
|
||||
$this->translator = $translator;
|
||||
$this->residentialAddressRepository = $residentialAddressRepository;
|
||||
public function __construct(private UrlGeneratorInterface $generator, private TranslatorInterface $translator, private ResidentialAddressRepository $residentialAddressRepository)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -22,11 +22,8 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class SocialWorkEvaluationApiController extends AbstractController
|
||||
{
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
public function __construct(PaginatorFactory $paginatorFactory)
|
||||
public function __construct(private PaginatorFactory $paginatorFactory)
|
||||
{
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,14 +21,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class SocialWorkGoalApiController extends ApiController
|
||||
{
|
||||
private GoalRepository $goalRepository;
|
||||
|
||||
private PaginatorFactory $paginator;
|
||||
|
||||
public function __construct(GoalRepository $goalRepository, PaginatorFactory $paginator)
|
||||
public function __construct(private GoalRepository $goalRepository, private PaginatorFactory $paginator)
|
||||
{
|
||||
$this->goalRepository = $goalRepository;
|
||||
$this->paginator = $paginator;
|
||||
}
|
||||
|
||||
public function listBySocialAction(Request $request, SocialAction $action): Response
|
||||
|
@@ -21,11 +21,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class SocialWorkResultApiController extends ApiController
|
||||
{
|
||||
private ResultRepository $resultRepository;
|
||||
|
||||
public function __construct(ResultRepository $resultRepository)
|
||||
public function __construct(private ResultRepository $resultRepository)
|
||||
{
|
||||
$this->resultRepository = $resultRepository;
|
||||
}
|
||||
|
||||
public function listByGoal(Request $request, Goal $goal): Response
|
||||
|
@@ -23,14 +23,8 @@ use function count;
|
||||
|
||||
class SocialWorkSocialActionApiController extends ApiController
|
||||
{
|
||||
private PaginatorFactory $paginator;
|
||||
|
||||
private SocialIssueRepository $socialIssueRepository;
|
||||
|
||||
public function __construct(SocialIssueRepository $socialIssueRepository, PaginatorFactory $paginator)
|
||||
public function __construct(private SocialIssueRepository $socialIssueRepository, private PaginatorFactory $paginator)
|
||||
{
|
||||
$this->socialIssueRepository = $socialIssueRepository;
|
||||
$this->paginator = $paginator;
|
||||
}
|
||||
|
||||
public function listBySocialIssueApi($id, Request $request)
|
||||
|
@@ -22,20 +22,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class TimelinePersonController extends AbstractController
|
||||
{
|
||||
protected EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
protected PaginatorFactory $paginatorFactory;
|
||||
|
||||
protected TimelineBuilder $timelineBuilder;
|
||||
|
||||
public function __construct(
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
TimelineBuilder $timelineBuilder,
|
||||
PaginatorFactory $paginatorFactory
|
||||
) {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->timelineBuilder = $timelineBuilder;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory)
|
||||
{
|
||||
}
|
||||
|
||||
public function personAction(Request $request, $person_id)
|
||||
|
@@ -19,14 +19,8 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class UserAccompanyingPeriodController extends AbstractController
|
||||
{
|
||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
public function __construct(AccompanyingPeriodRepository $accompanyingPeriodRepository, PaginatorFactory $paginatorFactory)
|
||||
public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private PaginatorFactory $paginatorFactory)
|
||||
{
|
||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -31,16 +31,8 @@ class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture
|
||||
*/
|
||||
private array $cacheEvaluations = [];
|
||||
|
||||
private EvaluationRepository $evaluationRepository;
|
||||
|
||||
private AccompanyingPeriodRepository $periodRepository;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodRepository $periodRepository,
|
||||
EvaluationRepository $evaluationRepository
|
||||
) {
|
||||
$this->periodRepository = $periodRepository;
|
||||
$this->evaluationRepository = $evaluationRepository;
|
||||
public function __construct(private AccompanyingPeriodRepository $periodRepository, private EvaluationRepository $evaluationRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function getDependencies()
|
||||
|
@@ -46,25 +46,11 @@ class LoadCustomFields extends AbstractFixture implements
|
||||
*/
|
||||
private $customFieldText;
|
||||
|
||||
/**
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
private $translatableStringHelper;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* LoadCustomFields constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
//put your code here
|
||||
|
@@ -37,18 +37,12 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface
|
||||
{
|
||||
private const NUMBER_OF_HOUSEHOLD = 10;
|
||||
|
||||
private MembersEditorFactory $editorFactory;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private NativeLoader $loader;
|
||||
|
||||
private array $personIds;
|
||||
|
||||
public function __construct(MembersEditorFactory $editorFactory, EntityManagerInterface $em)
|
||||
public function __construct(private MembersEditorFactory $editorFactory, private EntityManagerInterface $em)
|
||||
{
|
||||
$this->editorFactory = $editorFactory;
|
||||
$this->em = $em;
|
||||
$this->loader = new NativeLoader();
|
||||
}
|
||||
|
||||
|
@@ -86,24 +86,10 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
||||
*/
|
||||
protected array $cacheUsers = [];
|
||||
|
||||
protected CenterRepository $centerRepository;
|
||||
|
||||
protected CountryRepository $countryRepository;
|
||||
|
||||
protected Generator $faker;
|
||||
|
||||
protected NativeLoader $loader;
|
||||
|
||||
protected MaritalStatusRepository $maritalStatusRepository;
|
||||
|
||||
protected ScopeRepository $scopeRepository;
|
||||
|
||||
protected SocialIssueRepository $socialIssueRepository;
|
||||
|
||||
protected UserRepository $userRepository;
|
||||
|
||||
protected Registry $workflowRegistry;
|
||||
|
||||
private $genders = [Person::MALE_GENDER, Person::FEMALE_GENDER, Person::BOTH_GENDER];
|
||||
|
||||
private $peoples = [
|
||||
@@ -243,24 +229,17 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
Registry $workflowRegistry,
|
||||
SocialIssueRepository $socialIssueRepository,
|
||||
CenterRepository $centerRepository,
|
||||
CountryRepository $countryRepository,
|
||||
MaritalStatusRepository $maritalStatusRepository,
|
||||
ScopeRepository $scopeRepository,
|
||||
UserRepository $userRepository
|
||||
protected Registry $workflowRegistry,
|
||||
protected SocialIssueRepository $socialIssueRepository,
|
||||
protected CenterRepository $centerRepository,
|
||||
protected CountryRepository $countryRepository,
|
||||
protected MaritalStatusRepository $maritalStatusRepository,
|
||||
protected ScopeRepository $scopeRepository,
|
||||
protected UserRepository $userRepository
|
||||
) {
|
||||
$this->faker = Factory::create('fr_FR');
|
||||
$this->faker->addProvider($this);
|
||||
$this->workflowRegistry = $workflowRegistry;
|
||||
$this->socialIssueRepository = $socialIssueRepository;
|
||||
$this->centerRepository = $centerRepository;
|
||||
$this->countryRepository = $countryRepository;
|
||||
$this->maritalStatusRepository = $maritalStatusRepository;
|
||||
$this->loader = new NativeLoader($this->faker);
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function getOrder()
|
||||
|
@@ -28,11 +28,8 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
|
||||
{
|
||||
use PersonRandomHelper;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
public function __construct(private EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function getDependencies(): array
|
||||
|
@@ -21,11 +21,8 @@ use Throwable;
|
||||
|
||||
class LoadSocialWorkMetadata extends Fixture implements OrderedFixtureInterface
|
||||
{
|
||||
private SocialWorkMetadata $importer;
|
||||
|
||||
public function __construct(SocialWorkMetadata $importer)
|
||||
public function __construct(private SocialWorkMetadata $importer)
|
||||
{
|
||||
$this->importer = $importer;
|
||||
}
|
||||
|
||||
public function getOrder()
|
||||
|
@@ -1081,17 +1081,10 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
$container->setParameter('chill_person.person_fields', $config);
|
||||
|
||||
foreach ($config as $key => $value) {
|
||||
switch ($key) {
|
||||
case 'accompanying_period':
|
||||
$container->setParameter('chill_person.accompanying_period', $value);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$container->setParameter('chill_person.person_fields.' . $key, $value);
|
||||
|
||||
break;
|
||||
}
|
||||
match ($key) {
|
||||
'accompanying_period' => $container->setParameter('chill_person.accompanying_period', $value),
|
||||
default => $container->setParameter('chill_person.person_fields.' . $key, $value),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ class Configuration implements ConfigurationInterface
|
||||
->ifTrue(static function ($period) {
|
||||
try {
|
||||
$interval = new DateInterval($period);
|
||||
} catch (Exception $ex) {
|
||||
} catch (Exception) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -139,17 +139,10 @@ class Configuration implements ConfigurationInterface
|
||||
$tree = new TreeBuilder($key, 'enum');
|
||||
$node = $tree->getRootNode();
|
||||
|
||||
switch ($key) {
|
||||
case 'accompanying_period':
|
||||
$info = 'If the accompanying periods are shown';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$info = "If the field {$key} must be shown";
|
||||
|
||||
break;
|
||||
}
|
||||
$info = match ($key) {
|
||||
'accompanying_period' => 'If the accompanying periods are shown',
|
||||
default => "If the field {$key} must be shown",
|
||||
};
|
||||
|
||||
$node
|
||||
->values(['hidden', 'visible'])
|
||||
|
@@ -571,7 +571,7 @@ class AccompanyingPeriod implements
|
||||
*
|
||||
* @param mixed $person
|
||||
*/
|
||||
public function closeParticipationFor($person): ?AccompanyingPeriodParticipation
|
||||
public function closeParticipationFor(mixed $person): ?AccompanyingPeriodParticipation
|
||||
{
|
||||
$participation = $this->getOpenParticipationContainsPerson($person);
|
||||
|
||||
@@ -950,10 +950,9 @@ class AccompanyingPeriod implements
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person|ThirdParty
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
public function getRequestor()
|
||||
public function getRequestor(): \Chill\PersonBundle\Entity\Person|\Chill\ThirdPartyBundle\Entity\ThirdParty
|
||||
{
|
||||
return $this->requestorPerson ?? $this->requestorThirdParty;
|
||||
}
|
||||
@@ -1215,7 +1214,7 @@ class AccompanyingPeriod implements
|
||||
*
|
||||
* @return AccompanyingPeriod
|
||||
*/
|
||||
public function setClosingDate($closingDate)
|
||||
public function setClosingDate(mixed $closingDate)
|
||||
{
|
||||
$this->closingDate = $closingDate;
|
||||
|
||||
@@ -1274,11 +1273,10 @@ class AccompanyingPeriod implements
|
||||
/**
|
||||
* Set openingDate.
|
||||
*
|
||||
* @param mixed $openingDate
|
||||
*
|
||||
* @return AccompanyingPeriod
|
||||
*/
|
||||
public function setOpeningDate($openingDate)
|
||||
public function setOpeningDate(mixed $openingDate)
|
||||
{
|
||||
if ($this->openingDate !== $openingDate) {
|
||||
$this->openingDate = $openingDate;
|
||||
|
@@ -365,11 +365,9 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
|
||||
/**
|
||||
* Arbitrary data, used for client.
|
||||
*
|
||||
* @param mixed $key
|
||||
*
|
||||
* @return AccompanyingPeriodWorkEvaluation
|
||||
*/
|
||||
public function setKey($key): self
|
||||
public function setKey(mixed $key): self
|
||||
{
|
||||
$this->key = $key;
|
||||
|
||||
|
@@ -147,11 +147,9 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $key
|
||||
*
|
||||
* @return AccompanyingPeriodWorkEvaluationDocument
|
||||
*/
|
||||
public function setKey($key)
|
||||
public function setKey(mixed $key)
|
||||
{
|
||||
$this->key = $key;
|
||||
|
||||
|
@@ -94,10 +94,9 @@ class Resource
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person|ThirdParty
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
public function getResource()
|
||||
public function getResource(): \Chill\PersonBundle\Entity\Person|\Chill\ThirdPartyBundle\Entity\ThirdParty
|
||||
{
|
||||
return $this->person ?? $this->thirdParty;
|
||||
}
|
||||
|
@@ -26,12 +26,6 @@ class UserHistory implements TrackCreationInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="userHistories")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private ?AccompanyingPeriod $accompanyingPeriod;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
|
||||
*/
|
||||
@@ -49,17 +43,18 @@ class UserHistory implements TrackCreationInterface
|
||||
*/
|
||||
private DateTimeImmutable $startDate;
|
||||
|
||||
/**
|
||||
public function __construct(/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="userHistories")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private ?\Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod, /**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private User $user;
|
||||
|
||||
public function __construct(AccompanyingPeriod $accompanyingPeriod, User $user, ?DateTimeImmutable $startDate = null)
|
||||
{
|
||||
private User $user,
|
||||
?DateTimeImmutable $startDate = null
|
||||
) {
|
||||
$this->startDate = $startDate ?? new DateTimeImmutable('now');
|
||||
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getAccompanyingPeriod(): AccompanyingPeriod
|
||||
|
@@ -28,12 +28,6 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
||||
*/
|
||||
class AccompanyingPeriodParticipation
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false)
|
||||
*/
|
||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date", nullable=true)
|
||||
* @Groups({"read", "docgen:read"})
|
||||
@@ -48,24 +42,24 @@ class AccompanyingPeriodParticipation
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations")
|
||||
* @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false)
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date", nullable=false)
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?DateTime $startDate = null;
|
||||
|
||||
public function __construct(AccompanyingPeriod $accompanyingPeriod, Person $person)
|
||||
{
|
||||
public function __construct(/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false)
|
||||
*/
|
||||
private ?\Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod, /**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations")
|
||||
* @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false)
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?\Chill\PersonBundle\Entity\Person $person
|
||||
) {
|
||||
$this->startDate = new DateTime('now');
|
||||
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||
$this->person = $person;
|
||||
$person->getAccompanyingPeriodParticipations()->add($this);
|
||||
}
|
||||
|
||||
|
@@ -60,8 +60,6 @@ class MaritalStatus
|
||||
|
||||
/**
|
||||
* Set id.
|
||||
*
|
||||
* @return MaritalStatus
|
||||
*/
|
||||
public function setId(string $id): self
|
||||
{
|
||||
@@ -74,8 +72,6 @@ class MaritalStatus
|
||||
* Set name.
|
||||
*
|
||||
* @param string array $name
|
||||
*
|
||||
* @return MaritalStatus
|
||||
*/
|
||||
public function setName(array $name): self
|
||||
{
|
||||
|
@@ -74,7 +74,7 @@ use function in_array;
|
||||
* groups={"household_memberships"}
|
||||
* )
|
||||
*/
|
||||
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface
|
||||
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable
|
||||
{
|
||||
public const BOTH_GENDER = 'both';
|
||||
|
||||
@@ -554,7 +554,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getLabel();
|
||||
}
|
||||
@@ -631,7 +631,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
* @return true | array True if the accompanying periods are not collapsing,
|
||||
* an array with data for displaying the error
|
||||
*/
|
||||
public function checkAccompanyingPeriodsAreNotCollapsing()
|
||||
public function checkAccompanyingPeriodsAreNotCollapsing(): bool|array
|
||||
{
|
||||
$periods = $this->getAccompanyingPeriodsOrdered();
|
||||
$periodsNbr = count($periods);
|
||||
@@ -1165,19 +1165,12 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
*/
|
||||
public function getGenderNumeric()
|
||||
{
|
||||
switch ($this->getGender()) {
|
||||
case self::FEMALE_GENDER:
|
||||
return 1;
|
||||
|
||||
case self::MALE_GENDER:
|
||||
return 0;
|
||||
|
||||
case self::BOTH_GENDER:
|
||||
return 2;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return match ($this->getGender()) {
|
||||
self::FEMALE_GENDER => 1,
|
||||
self::MALE_GENDER => 0,
|
||||
self::BOTH_GENDER => 2,
|
||||
default => -1,
|
||||
};
|
||||
}
|
||||
|
||||
public function getHouseholdAddresses(): Collection
|
||||
@@ -1360,7 +1353,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
/**
|
||||
* @return PersonResource[]|Collection
|
||||
*/
|
||||
public function getResources()
|
||||
public function getResources(): array|\Doctrine\Common\Collections\Collection
|
||||
{
|
||||
return $this->resources;
|
||||
}
|
||||
@@ -1606,9 +1599,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person
|
||||
*/
|
||||
public function setCFData(?array $cFData): self
|
||||
{
|
||||
$this->cFData = $cFData;
|
||||
@@ -1824,16 +1814,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
|
||||
$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');
|
||||
}
|
||||
return match ($histories->count()) {
|
||||
0 => null,
|
||||
1 => $histories->first(),
|
||||
default => throw new UnexpectedValueException('It should not contains more than one center at a time'),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -32,11 +32,6 @@ class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterfac
|
||||
|
||||
use TrackUpdateTrait;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Center::class)
|
||||
*/
|
||||
private ?Center $center = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||
*/
|
||||
@@ -49,21 +44,20 @@ class PersonCenterHistory implements TrackCreationInterface, TrackUpdateInterfac
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="centerHistory")
|
||||
*/
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=false)
|
||||
*/
|
||||
private ?DateTimeImmutable $startDate = null;
|
||||
|
||||
public function __construct(?Person $person = null, ?Center $center = null, ?DateTimeImmutable $startDate = null)
|
||||
{
|
||||
$this->person = $person;
|
||||
$this->center = $center;
|
||||
$this->startDate = $startDate;
|
||||
public function __construct(
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="centerHistory")
|
||||
*/
|
||||
private ?\Chill\PersonBundle\Entity\Person $person = null,
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Center::class)
|
||||
*/
|
||||
private ?\Chill\MainBundle\Entity\Center $center = null,
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=false)
|
||||
*/
|
||||
private ?\DateTimeImmutable $startDate = null
|
||||
) {
|
||||
}
|
||||
|
||||
public function getCenter(): ?Center
|
||||
|
@@ -221,10 +221,8 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*
|
||||
* @param mixed $payload
|
||||
*/
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
public function validate(ExecutionContextInterface $context, mixed $payload)
|
||||
{
|
||||
if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) {
|
||||
$context->buildViolation('You must associate at least one entity')
|
||||
|
@@ -151,7 +151,7 @@ class SocialAction
|
||||
*
|
||||
* @return Collection|SocialAction[] a list with the elements of the given list which are parent of other elements in the given list
|
||||
*/
|
||||
public static function findAncestorSocialActions(Collection $socialActions): Collection
|
||||
public static function findAncestorSocialActions(\Doctrine\Common\Collections\Collection|array $socialActions): Collection
|
||||
{
|
||||
$ancestors = new ArrayCollection();
|
||||
|
||||
@@ -231,7 +231,7 @@ class SocialAction
|
||||
/**
|
||||
* @param Collection|SocialAction[] $socialActions
|
||||
*/
|
||||
public static function getDescendantsWithThisForActions($socialActions): Collection
|
||||
public static function getDescendantsWithThisForActions(\Doctrine\Common\Collections\Collection|array $socialActions): Collection
|
||||
{
|
||||
$unique = [];
|
||||
|
||||
|
@@ -74,7 +74,6 @@ class SocialIssue
|
||||
/**
|
||||
* @internal use @see{SocialIssue::setParent} instead
|
||||
*
|
||||
* @param SocialIssue $child
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -109,7 +108,7 @@ class SocialIssue
|
||||
*
|
||||
* @return Collection|SocialIssue[]
|
||||
*/
|
||||
public static function findAncestorSocialIssues(Collection $socialIssues): Collection
|
||||
public static function findAncestorSocialIssues(\Doctrine\Common\Collections\Collection|array $socialIssues): Collection
|
||||
{
|
||||
$ancestors = new ArrayCollection();
|
||||
|
||||
|
@@ -27,16 +27,12 @@ class PersonAddressMoveEvent extends Event
|
||||
|
||||
private ?HouseholdMember $nextMembership = null;
|
||||
|
||||
private Person $person;
|
||||
|
||||
private ?Address $previousAddress = null;
|
||||
|
||||
private ?HouseholdMember $previousMembership = null;
|
||||
|
||||
public function __construct(
|
||||
Person $person
|
||||
) {
|
||||
$this->person = $person;
|
||||
public function __construct(private Person $person)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class AccompanyingPeriodWorkEventListener
|
||||
{
|
||||
private Security $security;
|
||||
|
||||
public function __construct(Security $security)
|
||||
public function __construct(private Security $security)
|
||||
{
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function prePersistAccompanyingPeriodWork(AccompanyingPeriodWork $work): void
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
class AdministrativeLocationAggregator implements AggregatorInterface
|
||||
{
|
||||
private LocationRepository $locationRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
LocationRepository $locationRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->locationRepository = $locationRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private LocationRepository $locationRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ClosingMotiveAggregator implements AggregatorInterface
|
||||
{
|
||||
private ClosingMotiveRepositoryInterface $motiveRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ClosingMotiveRepositoryInterface $motiveRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->motiveRepository = $motiveRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private ClosingMotiveRepositoryInterface $motiveRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ConfidentialAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -56,16 +52,11 @@ class ConfidentialAggregator implements AggregatorInterface
|
||||
return 'Confidentiality';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case true:
|
||||
return $this->translator->trans('is confidential');
|
||||
|
||||
case false:
|
||||
return $this->translator->trans('is not confidential');
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
return match ($value) {
|
||||
true => $this->translator->trans('is confidential'),
|
||||
false => $this->translator->trans('is not confidential'),
|
||||
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
class CreatorJobAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserJobRepository $jobRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
UserJobRepository $jobRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->jobRepository = $jobRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -28,11 +28,8 @@ final class DurationAggregator implements AggregatorInterface
|
||||
'day',
|
||||
];
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -42,26 +39,13 @@ final class DurationAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
switch ($data['precision']) {
|
||||
case 'day':
|
||||
$qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) AS duration_aggregator');
|
||||
|
||||
break;
|
||||
|
||||
case 'week':
|
||||
$qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) / 7 AS duration_aggregator');
|
||||
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
$qb->addSelect('(EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 +
|
||||
EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate))) AS duration_aggregator');
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new LogicException('precision not supported: ' . $data['precision']);
|
||||
}
|
||||
match ($data['precision']) {
|
||||
'day' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) AS duration_aggregator'),
|
||||
'week' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) / 7 AS duration_aggregator'),
|
||||
'month' => $qb->addSelect('(EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 +
|
||||
EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate))) AS duration_aggregator'),
|
||||
default => throw new LogicException('precision not supported: ' . $data['precision']),
|
||||
};
|
||||
|
||||
$qb
|
||||
->setParameter('now', new DateTimeImmutable('now'))
|
||||
|
@@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class EmergencyAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -56,16 +52,11 @@ class EmergencyAggregator implements AggregatorInterface
|
||||
return 'Emergency';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case true:
|
||||
return $this->translator->trans('is emergency');
|
||||
|
||||
case false:
|
||||
return $this->translator->trans('is not emergency');
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
return match ($value) {
|
||||
true => $this->translator->trans('is emergency'),
|
||||
false => $this->translator->trans('is not emergency'),
|
||||
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
final class EvaluationAggregator implements AggregatorInterface
|
||||
{
|
||||
private EvaluationRepository $evaluationRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
EvaluationRepository $evaluationRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->evaluationRepository = $evaluationRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -29,20 +29,8 @@ use UnexpectedValueException;
|
||||
|
||||
final class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||
{
|
||||
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository;
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -134,36 +122,31 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||
|
||||
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';
|
||||
}
|
||||
return match ($key) {
|
||||
'acp_geog_agg_unitname' => static function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'acp_geog_agg_unitname';
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value) {
|
||||
return '';
|
||||
}
|
||||
if (null === $value || '' === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
return $value;
|
||||
},
|
||||
'acp_geog_agg_unitrefid' => static function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'acp_geog_agg_unitrefid';
|
||||
}
|
||||
|
||||
case 'acp_geog_agg_unitrefid':
|
||||
return static function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'acp_geog_agg_unitrefid';
|
||||
}
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
|
||||
default:
|
||||
throw new UnexpectedValueException('this value should not happens');
|
||||
}
|
||||
return $value;
|
||||
},
|
||||
default => throw new UnexpectedValueException('this value should not happens'),
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
|
@@ -20,12 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class IntensityAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -56,16 +52,11 @@ class IntensityAggregator implements AggregatorInterface
|
||||
return 'Intensity';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case 'occasional':
|
||||
return $this->translator->trans('is occasional');
|
||||
|
||||
case 'regular':
|
||||
return $this->translator->trans('is regular');
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
return match ($value) {
|
||||
'occasional' => $this->translator->trans('is occasional'),
|
||||
'regular' => $this->translator->trans('is regular'),
|
||||
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -25,14 +25,11 @@ final class OriginAggregator implements AggregatorInterface
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
private TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->repository = $em->getRepository(Origin::class);
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -27,20 +27,8 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
|
||||
private const P = 'acp_ref_agg_date';
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
UserRender $userRender,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private UserRepository $userRepository, private UserRender $userRender, private RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -26,20 +26,8 @@ class ReferrerScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
private const SCOPE_KEY = 'acp_agg_refscope_user_history_ref_scope_name';
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private ScopeRepositoryInterface $scopeRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ScopeRepositoryInterface $scopeRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -20,12 +20,8 @@ use function in_array;
|
||||
|
||||
final class RequestorAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
final class ScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
private ScopeRepository $scopeRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ScopeRepository $scopeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
final class SocialActionAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialActionRender $actionRender;
|
||||
|
||||
private SocialActionRepository $actionRepository;
|
||||
|
||||
public function __construct(
|
||||
SocialActionRender $actionRender,
|
||||
SocialActionRepository $actionRepository
|
||||
) {
|
||||
$this->actionRender = $actionRender;
|
||||
$this->actionRepository = $actionRepository;
|
||||
public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
final class SocialIssueAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialIssueRender $issueRender;
|
||||
|
||||
private SocialIssueRepository $issueRepository;
|
||||
|
||||
public function __construct(
|
||||
SocialIssueRepository $issueRepository,
|
||||
SocialIssueRender $issueRender
|
||||
) {
|
||||
$this->issueRepository = $issueRepository;
|
||||
$this->issueRender = $issueRender;
|
||||
public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -28,16 +28,8 @@ final class StepAggregator implements AggregatorInterface
|
||||
|
||||
private const P = 'acp_step_agg_date';
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
RollingDateConverterInterface $rollingDateConverter,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private RollingDateConverterInterface $rollingDateConverter, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
final class UserJobAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserJobRepository $jobRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
UserJobRepository $jobRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->jobRepository = $jobRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -38,25 +38,12 @@ class ByEndDateAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
switch ($data['frequency']) {
|
||||
case 'week':
|
||||
$fmt = 'YYYY-IW';
|
||||
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
$fmt = 'YYYY-MM';
|
||||
|
||||
break;
|
||||
|
||||
case 'year':
|
||||
$fmt = 'YYYY';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||
}
|
||||
$fmt = match ($data['frequency']) {
|
||||
'week' => 'YYYY-IW',
|
||||
'month' => 'YYYY-MM',
|
||||
'year' => 'YYYY',
|
||||
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
|
||||
};
|
||||
|
||||
$qb->addSelect(sprintf("TO_CHAR(workeval.endDate, '%s') AS eval_by_end_date_aggregator", $fmt));
|
||||
$qb->addGroupBy(' eval_by_end_date_aggregator');
|
||||
|
@@ -38,25 +38,12 @@ class ByMaxDateAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
switch ($data['frequency']) {
|
||||
case 'week':
|
||||
$fmt = 'YYYY-IW';
|
||||
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
$fmt = 'YYYY-MM';
|
||||
|
||||
break;
|
||||
|
||||
case 'year':
|
||||
$fmt = 'YYYY';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||
}
|
||||
$fmt = match ($data['frequency']) {
|
||||
'week' => 'YYYY-IW',
|
||||
'month' => 'YYYY-MM',
|
||||
'year' => 'YYYY',
|
||||
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
|
||||
};
|
||||
|
||||
$qb->addSelect(sprintf("TO_CHAR(workeval.maxDate, '%s') AS eval_by_max_date_aggregator", $fmt));
|
||||
$qb->addGroupBy(' eval_by_max_date_aggregator');
|
||||
|
@@ -38,25 +38,12 @@ class ByStartDateAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
switch ($data['frequency']) {
|
||||
case 'week':
|
||||
$fmt = 'YYYY-IW';
|
||||
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
$fmt = 'YYYY-MM';
|
||||
|
||||
break;
|
||||
|
||||
case 'year':
|
||||
$fmt = 'YYYY';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||
}
|
||||
$fmt = match ($data['frequency']) {
|
||||
'week' => 'YYYY-IW',
|
||||
'month' => 'YYYY-MM',
|
||||
'year' => 'YYYY',
|
||||
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
|
||||
};
|
||||
|
||||
$qb->addSelect(sprintf("TO_CHAR(workeval.startDate, '%s') AS eval_by_start_date_aggregator", $fmt));
|
||||
$qb->addGroupBy(' eval_by_start_date_aggregator');
|
||||
|
@@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class EvaluationTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
private EvaluationRepository $evaluationRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
EvaluationRepository $evaluationRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->evaluationRepository = $evaluationRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class HavingEndDateAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -56,16 +53,11 @@ class HavingEndDateAggregator implements AggregatorInterface
|
||||
return 'export.aggregator.eval.by_end_date.Has end date ?';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case true:
|
||||
return $this->translator->trans('export.aggregator.eval.by_end_date.enddate is specified');
|
||||
|
||||
case false:
|
||||
return $this->translator->trans('export.aggregator.eval.by_end_date.enddate is not specified');
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
return match ($value) {
|
||||
true => $this->translator->trans('export.aggregator.eval.by_end_date.enddate is specified'),
|
||||
false => $this->translator->trans('export.aggregator.eval.by_end_date.enddate is not specified'),
|
||||
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -24,16 +24,8 @@ use function in_array;
|
||||
|
||||
class ChildrenNumberAggregator implements AggregatorInterface
|
||||
{
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -25,20 +25,8 @@ use function in_array;
|
||||
|
||||
class CompositionAggregator implements AggregatorInterface
|
||||
{
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
private HouseholdCompositionTypeRepository $typeRepository;
|
||||
|
||||
public function __construct(
|
||||
HouseholdCompositionTypeRepository $typeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->typeRepository = $typeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private HouseholdCompositionTypeRepository $typeRepository, private TranslatableStringHelper $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -22,11 +22,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class AgeAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -27,20 +27,8 @@ class ByHouseholdCompositionAggregator implements AggregatorInterface
|
||||
{
|
||||
private const PREFIX = 'acp_by_household_compo_agg';
|
||||
|
||||
private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository;
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
RollingDateConverterInterface $rollingDateConverter,
|
||||
HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->householdCompositionTypeRepository = $householdCompositionTypeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private RollingDateConverterInterface $rollingDateConverter, private HouseholdCompositionTypeRepositoryInterface $householdCompositionTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -27,20 +27,8 @@ use function in_array;
|
||||
|
||||
final class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||
{
|
||||
private CountryRepository $countriesRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
CountryRepository $countriesRepository,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->countriesRepository = $countriesRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,11 +21,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class GenderAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -26,20 +26,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class GeographicalUnitAggregator implements AggregatorInterface
|
||||
{
|
||||
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository;
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->geographicalUnitLayerRepository = $geographicalUnitLayerRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -111,36 +99,31 @@ class GeographicalUnitAggregator implements AggregatorInterface
|
||||
|
||||
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';
|
||||
}
|
||||
return match ($key) {
|
||||
'geog_unit_name' => static function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'acp_geog_agg_unitname';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
return $value;
|
||||
},
|
||||
'geog_unit_key' => static function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'acp_geog_agg_unitrefid';
|
||||
}
|
||||
|
||||
case 'geog_unit_key':
|
||||
return static function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'acp_geog_agg_unitrefid';
|
||||
}
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
|
||||
default:
|
||||
throw new LogicException('key not supported');
|
||||
}
|
||||
return $value;
|
||||
},
|
||||
default => throw new LogicException('key not supported'),
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
|
@@ -29,24 +29,8 @@ use function in_array;
|
||||
|
||||
final class HouseholdPositionAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||
{
|
||||
private PositionRepository $positionRepository;
|
||||
|
||||
private RollingDateConverterInterface $rollingDateConverter;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
PositionRepository $positionRepository,
|
||||
RollingDateConverterInterface $rollingDateConverter
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->positionRepository = $positionRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->rollingDateConverter = $rollingDateConverter;
|
||||
public function __construct(private TranslatorInterface $translator, private TranslatableStringHelper $translatableStringHelper, private PositionRepository $positionRepository, private RollingDateConverterInterface $rollingDateConverter)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,14 +21,8 @@ use function in_array;
|
||||
|
||||
final class MaritalStatusAggregator implements AggregatorInterface
|
||||
{
|
||||
private MaritalStatusRepository $maritalStatusRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(MaritalStatusRepository $maritalStatusRepository, TranslatableStringHelper $translatableStringHelper)
|
||||
public function __construct(private MaritalStatusRepository $maritalStatusRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->maritalStatusRepository = $maritalStatusRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -25,20 +25,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class NationalityAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||
{
|
||||
private CountryRepository $countriesRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
CountryRepository $countriesRepository,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->countriesRepository = $countriesRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->translator = $translator;
|
||||
public function __construct(private CountryRepository $countriesRepository, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -24,24 +24,8 @@ use function in_array;
|
||||
|
||||
final class ActionTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialActionRender $actionRender;
|
||||
|
||||
private SocialActionRepository $socialActionRepository;
|
||||
|
||||
private SocialIssueRender $socialIssueRender;
|
||||
|
||||
private SocialIssueRepository $socialIssueRepository;
|
||||
|
||||
public function __construct(
|
||||
SocialActionRepository $socialActionRepository,
|
||||
SocialActionRender $actionRender,
|
||||
SocialIssueRender $socialIssueRender,
|
||||
SocialIssueRepository $socialIssueRepository
|
||||
) {
|
||||
$this->socialActionRepository = $socialActionRepository;
|
||||
$this->actionRender = $actionRender;
|
||||
$this->socialIssueRender = $socialIssueRender;
|
||||
$this->socialIssueRepository = $socialIssueRepository;
|
||||
public function __construct(private SocialActionRepository $socialActionRepository, private SocialActionRender $actionRender, private SocialIssueRender $socialIssueRender, private SocialIssueRepository $socialIssueRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -78,36 +62,31 @@ final class ActionTypeAggregator implements AggregatorInterface
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
switch ($key) {
|
||||
case 'action_type_aggregator':
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Social Action Type';
|
||||
}
|
||||
return match ($key) {
|
||||
'action_type_aggregator' => function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Social Action Type';
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value || null === $sa = $this->socialActionRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
if (null === $value || '' === $value || null === $sa = $this->socialActionRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
};
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
},
|
||||
'social_action_type_aggregator' => function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Social Issue';
|
||||
}
|
||||
|
||||
case 'social_action_type_aggregator':
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Social Issue';
|
||||
}
|
||||
if (null === $value || null === $si = $this->socialIssueRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (null === $value || null === $si = $this->socialIssueRepository->find($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->socialIssueRender->renderString($si, []);
|
||||
};
|
||||
|
||||
default:
|
||||
throw new LogicException('this key is not supported: ' . $key);
|
||||
}
|
||||
return $this->socialIssueRender->renderString($si, []);
|
||||
},
|
||||
default => throw new LogicException('this key is not supported: ' . $key),
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
|
@@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class CurrentActionAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(private TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@@ -59,16 +56,11 @@ class CurrentActionAggregator implements AggregatorInterface
|
||||
return 'export.aggregator.course_work.by_current_action.Current action ?';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case true:
|
||||
return $this->translator->trans('export.aggregator.course_work.by_current_action.Current action');
|
||||
|
||||
case false:
|
||||
return $this->translator->trans('export.aggregator.course_work.by_current_action.Not current action');
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
return match ($value) {
|
||||
true => $this->translator->trans('export.aggregator.course_work.by_current_action.Current action'),
|
||||
false => $this->translator->trans('export.aggregator.course_work.by_current_action.Not current action'),
|
||||
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -21,14 +21,8 @@ use function in_array;
|
||||
|
||||
final class GoalAggregator implements AggregatorInterface
|
||||
{
|
||||
private GoalRepository $goalRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(GoalRepository $goalRepository, TranslatableStringHelper $translatableStringHelper)
|
||||
public function __construct(private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->goalRepository = $goalRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -23,20 +23,8 @@ use function in_array;
|
||||
|
||||
class GoalResultAggregator implements AggregatorInterface
|
||||
{
|
||||
private GoalRepository $goalRepository;
|
||||
|
||||
private ResultRepository $resultRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ResultRepository $resultRepository,
|
||||
GoalRepository $goalRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->resultRepository = $resultRepository;
|
||||
$this->goalRepository = $goalRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private ResultRepository $resultRepository, private GoalRepository $goalRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
final class JobAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserJobRepository $jobRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
UserJobRepository $jobRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->jobRepository = $jobRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private UserJobRepository $jobRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
final class ReferrerAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
UserRender $userRender
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
public function __construct(private UserRepository $userRepository, private UserRender $userRender)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,14 +21,8 @@ use function in_array;
|
||||
|
||||
final class ResultAggregator implements AggregatorInterface
|
||||
{
|
||||
private ResultRepository $resultRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(ResultRepository $resultRepository, TranslatableStringHelper $translatableStringHelper)
|
||||
public function __construct(private ResultRepository $resultRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->resultRepository = $resultRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
||||
|
||||
final class ScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
private ScopeRepository $scopeRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ScopeRepository $scopeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
|
@@ -26,12 +26,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->em = $em;
|
||||
public function __construct(protected EntityManagerInterface $em)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder): void
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user