Apply rector rules: symfony up to 54

This commit is contained in:
2024-04-04 23:30:25 +02:00
parent 1ee3b9e2f0
commit 579bd829f8
204 changed files with 974 additions and 2346 deletions

View File

@@ -23,6 +23,8 @@ use Symfony\Component\Console\Output\OutputInterface;
final class ChillPersonMoveCommand extends Command
{
protected static $defaultDescription = 'Move all the associated entities on a "from" person to a "to" person and remove the old person';
public function __construct(
private readonly PersonMove $mover,
private readonly EntityManagerInterface $em,
@@ -53,7 +55,6 @@ final class ChillPersonMoveCommand extends Command
{
$this
->setName('chill:person:move')
->setDescription('Move all the associated entities on a "from" person to a "to" person and remove the old person')
->addOption('from', 'f', InputOption::VALUE_REQUIRED, 'The person id to delete, all associated data will be moved before')
->addOption('to', 't', InputOption::VALUE_REQUIRED, 'The person id which will received data')
->addOption('dump-sql', null, InputOption::VALUE_NONE, 'dump sql to stdout')
@@ -99,7 +100,7 @@ final class ChillPersonMoveCommand extends Command
$this->chillLogger->notice('Move a person from command line succeeded', $ctxt);
}
return 0;
return Command::SUCCESS;
}
protected function interact(InputInterface $input, OutputInterface $output)

View File

@@ -41,7 +41,6 @@ final class ImportSocialWorkMetadata extends Command
->setName('chill:person:import-socialwork')
->addOption('filepath', 'f', InputOption::VALUE_REQUIRED, 'The file to import.')
->addOption('language', 'l', InputOption::VALUE_OPTIONAL, 'The default language')
->setDescription($description)
->setHelp($help);
}

View File

@@ -20,6 +20,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class RemoveOldDraftAccompanyingPeriodCommand extends Command
{
protected static $defaultDescription = 'Remove draft accompanying period which are still draft and unused';
public function __construct(private readonly LoggerInterface $logger, private readonly OldDraftAccompanyingPeriodRemoverInterface $remover)
{
parent::__construct('chill:person:remove-old-draft-period');
@@ -28,7 +30,6 @@ class RemoveOldDraftAccompanyingPeriodCommand extends Command
protected function configure(): void
{
$this
->setDescription('Remove draft accompanying period which are still draft and unused')
->addArgument('interval', InputArgument::OPTIONAL, 'The interval for unactive periods', 'P15D');
}
@@ -50,6 +51,6 @@ class RemoveOldDraftAccompanyingPeriodCommand extends Command
$this->logger->info('['.$this->getName().'] end of command');
return 0;
return Command::SUCCESS;
}
}

View File

@@ -79,9 +79,7 @@ final class AccompanyingCourseApiController extends ApiController
]);
}
/**
* @Route("/api/1.0/person/accompanying-course/list/by-recent-attributions")
*/
#[Route(path: '/api/1.0/person/accompanying-course/list/by-recent-attributions')]
public function findMyRecentCourseAttribution(Request $request): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_USER');
@@ -247,11 +245,7 @@ final class AccompanyingCourseApiController extends ApiController
return $this->addRemoveSomething('socialissue', $id, $request, $_format, 'socialIssue', SocialIssue::class, ['groups' => ['read']]);
}
/**
* @Route("/api/1.0/person/accompanying-course/{id}/referrers-suggested.{_format}",
* requirements={ "_format": "json"},
* name="chill_api_person_accompanying_period_referrers_suggested")
*/
#[Route(path: '/api/1.0/person/accompanying-course/{id}/referrers-suggested.{_format}', requirements: ['_format' => 'json'], name: 'chill_api_person_accompanying_period_referrers_suggested')]
public function suggestReferrals(AccompanyingPeriod $period, string $_format = 'json'): JsonResponse
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $period);
@@ -278,10 +272,9 @@ 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"})
*/
#[Route(path: '/api/1.0/person/accompanying-course/{id}/confidential.json', name: 'chill_api_person_accompanying_period_confidential')]
public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, mixed $id, Request $request)
{
if ('POST' === $request->getMethod()) {
@@ -296,10 +289,9 @@ final class AccompanyingCourseApiController extends ApiController
}
/**
* @Route("/api/1.0/person/accompanying-course/{id}/intensity.json", name="chill_api_person_accompanying_period_intensity")
*
* @ParamConverter("accompanyingCourse", options={"id": "id"})
*/
#[Route(path: '/api/1.0/person/accompanying-course/{id}/intensity.json', name: 'chill_api_person_accompanying_period_intensity')]
public function toggleIntensityApi(AccompanyingPeriod $accompanyingCourse, Request $request)
{
if ('POST' === $request->getMethod()) {

View File

@@ -41,10 +41,9 @@ class AccompanyingCourseCommentController extends AbstractController
/**
* Page of comments in Accompanying Course section.
*
* @Route("/{_locale}/parcours/{accompanying_period_id}/comments", name="chill_person_accompanying_period_comment_list")
*
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
*/
#[Route(path: '/{_locale}/parcours/{accompanying_period_id}/comments', name: 'chill_person_accompanying_period_comment_list')]
public function commentAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE_DETAILS, $accompanyingCourse);
@@ -118,12 +117,8 @@ class AccompanyingCourseCommentController extends AbstractController
/**
* Delete an existing comment.
*
* @Route(
* "/{_locale}/parcours/comment/{id}/delete",
* name="chill_person_accompanying_period_comment_delete"
* )
*/
#[Route(path: '/{_locale}/parcours/comment/{id}/delete', name: 'chill_person_accompanying_period_comment_delete')]
public function deleteAction(AccompanyingPeriod\Comment $comment, Request $request): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodCommentVoter::DELETE, $comment);
@@ -159,9 +154,7 @@ class AccompanyingCourseCommentController extends AbstractController
]);
}
/**
* @Route("/{_locale}/parcours/comment/{id}/pin", name="chill_person_accompanying_period_comment_pin")
*/
#[Route(path: '/{_locale}/parcours/comment/{id}/pin', name: 'chill_person_accompanying_period_comment_pin')]
public function pinComment(AccompanyingPeriod\Comment $comment): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $comment->getAccompanyingPeriod());
@@ -177,9 +170,7 @@ class AccompanyingCourseCommentController extends AbstractController
]);
}
/**
* @Route("/{_locale}/parcours/comment/{id}/unpin", name="chill_person_accompanying_period_comment_unpin")
*/
#[Route(path: '/{_locale}/parcours/comment/{id}/unpin', name: 'chill_person_accompanying_period_comment_unpin')]
public function unpinComment(AccompanyingPeriod\Comment $comment): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $comment->getAccompanyingPeriod());

View File

@@ -15,7 +15,6 @@ use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Form\AccompanyingCourseType;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Chill\PersonBundle\Repository\PersonRepository;
@@ -50,10 +49,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
) {}
/**
* @Route("/{_locale}/parcours/{accompanying_period_id}/close", name="chill_person_accompanying_course_close")
*
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
*/
#[Route(path: '/{_locale}/parcours/{accompanying_period_id}/close', name: 'chill_person_accompanying_course_close')]
public function closeAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse);
@@ -97,10 +95,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
/**
* Delete page of Accompanying Course section.
*
* @Route("/{_locale}/parcours/{accompanying_period_id}/delete", name="chill_person_accompanying_course_delete")
*
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
*/
#[Route(path: '/{_locale}/parcours/{accompanying_period_id}/delete', name: 'chill_person_accompanying_course_delete')]
public function deleteAction(Request $request, AccompanyingPeriod $accompanyingCourse)
{
$em = $this->managerRegistry->getManager();
@@ -154,10 +151,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
*
* the page edit all blocks managed by vuejs component
*
* @Route("/{_locale}/parcours/{accompanying_period_id}/edit", name="chill_person_accompanying_course_edit")
*
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
*/
#[Route(path: '/{_locale}/parcours/{accompanying_period_id}/edit', name: 'chill_person_accompanying_course_edit')]
public function editAction(AccompanyingPeriod $accompanyingCourse): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse);
@@ -172,10 +168,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
*
* the page show anti chronologic history with all actions, title of page is 'Accompanying Course History'
*
* @Route("/{_locale}/parcours/{accompanying_period_id}/history", name="chill_person_accompanying_course_history")
*
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
*/
#[Route(path: '/{_locale}/parcours/{accompanying_period_id}/history', name: 'chill_person_accompanying_course_history')]
public function historyAction(AccompanyingPeriod $accompanyingCourse): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse);
@@ -188,10 +183,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
/**
* Homepage of Accompanying Course section.
*
* @Route("/{_locale}/parcours/{accompanying_period_id}", name="chill_person_accompanying_course_index")
*
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
*/
#[Route(path: '/{_locale}/parcours/{accompanying_period_id}', name: 'chill_person_accompanying_course_index')]
public function indexAction(AccompanyingPeriod $accompanyingCourse): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse);
@@ -228,9 +222,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
]);
}
/**
* @Route("/{_locale}/person/parcours/new", name="chill_person_accompanying_course_new")
*/
#[Route(path: '/{_locale}/person/parcours/new', name: 'chill_person_accompanying_course_new')]
public function newAction(Request $request): Response
{
$user = $this->security->getUser();
@@ -268,9 +260,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
]);
}
/**
* @Route("/{_locale}/person/household/parcours/new", name="chill_household_accompanying_course_new")
*/
#[Route(path: '/{_locale}/person/household/parcours/new', name: 'chill_household_accompanying_course_new')]
public function newHouseholdParcoursAction(Request $request): Response
{
$user = $this->getUser();
@@ -308,10 +298,9 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
}
/**
* @Route("/{_locale}/parcours/{accompanying_period_id}/open", name="chill_person_accompanying_course_reopen")
*
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
*/
#[Route(path: '/{_locale}/parcours/{accompanying_period_id}/open', name: 'chill_person_accompanying_course_reopen')]
public function reOpenAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse);

View File

@@ -29,9 +29,7 @@ class AccompanyingCourseWorkApiController extends ApiController
private readonly Security $security,
) {}
/**
* @Route("/api/1.0/person/accompanying-period/work/my-near-end")
*/
#[Route(path: '/api/1.0/person/accompanying-period/work/my-near-end')]
public function myWorksNearEndDate(Request $request): JsonResponse
{
$user = $this->security->getUser();

View File

@@ -17,7 +17,6 @@ use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
@@ -44,13 +43,7 @@ final class AccompanyingCourseWorkController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @Route(
* "{_locale}/person/accompanying-period/{id}/work/new",
* name="chill_person_accompanying_period_work_new",
* methods={"GET"}
* )
*/
#[Route(path: '{_locale}/person/accompanying-period/{id}/work/new', name: 'chill_person_accompanying_period_work_new', methods: ['GET'])]
public function createWork(AccompanyingPeriod $period): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::CREATE, $period);
@@ -77,13 +70,7 @@ final class AccompanyingCourseWorkController extends AbstractController
]);
}
/**
* @Route(
* "{_locale}/person/accompanying-period/work/{id}/delete",
* name="chill_person_accompanying_period_work_delete",
* methods={"GET", "POST", "DELETE"}
* )
*/
#[Route(path: '{_locale}/person/accompanying-period/work/{id}/delete', name: 'chill_person_accompanying_period_work_delete', methods: ['GET', 'POST', 'DELETE'])]
public function deleteWork(AccompanyingPeriodWork $work, Request $request): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work);
@@ -123,13 +110,7 @@ final class AccompanyingCourseWorkController extends AbstractController
]);
}
/**
* @Route(
* "{_locale}/person/accompanying-period/work/{id}/edit",
* name="chill_person_accompanying_period_work_edit",
* methods={"GET"}
* )
*/
#[Route(path: '{_locale}/person/accompanying-period/work/{id}/edit', name: 'chill_person_accompanying_period_work_edit', methods: ['GET'])]
public function editWork(AccompanyingPeriodWork $work): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work);
@@ -143,13 +124,7 @@ final class AccompanyingCourseWorkController extends AbstractController
]);
}
/**
* @Route(
* "{_locale}/person/accompanying-period/{id}/work",
* name="chill_person_accompanying_period_work_list",
* methods={"GET"}
* )
*/
#[Route(path: '{_locale}/person/accompanying-period/{id}/work', name: 'chill_person_accompanying_period_work_list', methods: ['GET'])]
public function listWorkByAccompanyingPeriod(AccompanyingPeriod $period): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::SEE, $period);
@@ -181,13 +156,7 @@ final class AccompanyingCourseWorkController extends AbstractController
]);
}
/**
* @Route(
* "{_locale}/person/accompanying-period/work/{id}/show",
* name="chill_person_accompanying_period_work_show",
* methods={"GET"}
* )
*/
#[Route(path: '{_locale}/person/accompanying-period/work/{id}/show', name: 'chill_person_accompanying_period_work_show', methods: ['GET'])]
public function showWork(AccompanyingPeriodWork $work): Response
{
if (null === $work) {

View File

@@ -22,13 +22,7 @@ class AccompanyingCourseWorkEvaluationDocumentController extends AbstractControl
{
public function __construct(private readonly Security $security) {}
/**
* @Route(
* "{_locale}/person/accompanying-period/work/evaluation/document/{id}/show",
* name="chill_person_accompanying_period_work_evaluation_document_show",
* methods={"GET"}
* )
*/
#[Route(path: '{_locale}/person/accompanying-period/work/evaluation/document/{id}/show', name: 'chill_person_accompanying_period_work_evaluation_document_show', methods: ['GET'])]
public function showAccompanyingCourseWork(AccompanyingPeriodWorkEvaluationDocument $document): Response
{
$work = $document->getAccompanyingPeriodWorkEvaluation()->getAccompanyingPeriodWork();

View File

@@ -44,9 +44,8 @@ class AccompanyingPeriodController extends AbstractController
/**
* @throws \Exception
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/close", name="chill_person_accompanying_period_close")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/close', name: 'chill_person_accompanying_period_close')]
public function closeAction(int $person_id, Request $request): Response
{
$person = $this->_getPerson($person_id);
@@ -123,9 +122,7 @@ class AccompanyingPeriodController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/create", name="chill_person_accompanying_period_create")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/create', name: 'chill_person_accompanying_period_create')]
public function createAction(int $person_id, Request $request): Response
{
$person = $this->_getPerson($person_id);
@@ -190,10 +187,9 @@ class AccompanyingPeriodController extends AbstractController
}
/**
* @ParamConverter("person", options={"id": "person_id"})
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period", name="chill_person_accompanying_period_list")
* @ParamConverter("person", options={"id"="person_id"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period', name: 'chill_person_accompanying_period_list')]
public function listAction(Person $person): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $person);
@@ -218,9 +214,7 @@ class AccompanyingPeriodController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/open", name="chill_person_accompanying_period_open")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/open', name: 'chill_person_accompanying_period_open')]
public function openAction(int $person_id, Request $request): Response
{
$person = $this->_getPerson($person_id);
@@ -303,9 +297,7 @@ class AccompanyingPeriodController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open", name="chill_person_accompanying_period_re_open")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open', name: 'chill_person_accompanying_period_re_open')]
public function reOpenAction(int $person_id, int $period_id, Request $request): Response
{
/** @var Person $person */
@@ -353,9 +345,8 @@ class AccompanyingPeriodController extends AbstractController
/**
* @throws Exception
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/accompanying-period/{period_id}/update", name="chill_person_accompanying_period_update")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/accompanying-period/{period_id}/update', name: 'chill_person_accompanying_period_update')]
public function updateAction(int $person_id, int $period_id, Request $request): Response
{
$em = $this->managerRegistry->getManager();

View File

@@ -33,9 +33,7 @@ class AccompanyingPeriodRegulationListController
{
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
/**
* @Route("/{_locale}/person/periods/undispatched", name="chill_person_course_list_regulation")
*/
#[Route(path: '/{_locale}/person/periods/undispatched', name: 'chill_person_course_list_regulation')]
public function listRegul(Request $request): Response
{
if (!$this->security->isGranted('ROLE_USER') || !$this->security->getUser() instanceof User) {

View File

@@ -31,10 +31,7 @@ class AccompanyingPeriodWorkEvaluationApiController
{
public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $accompanyingPeriodWorkEvaluationRepository, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly SerializerInterface $serializer, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security) {}
/**
* @Route("/api/1.0/person/docgen/template/by-evaluation/{id}.{_format}",
* requirements={"format": "json"})
*/
#[Route(path: '/api/1.0/person/docgen/template/by-evaluation/{id}.{_format}', requirements: ['format' => 'json'])]
public function listTemplateByEvaluation(Evaluation $evaluation, string $_format): JsonResponse
{
if ('json' !== $_format) {
@@ -64,9 +61,7 @@ class AccompanyingPeriodWorkEvaluationApiController
), JsonResponse::HTTP_OK, [], true);
}
/**
* @Route("/api/1.0/person/accompanying-period/work/evaluation/my-near-end")
*/
#[Route(path: '/api/1.0/person/accompanying-period/work/evaluation/my-near-end')]
public function myWorksNearEndDate(Request $request): JsonResponse
{
$total = $this->accompanyingPeriodWorkEvaluationRepository

View File

@@ -19,33 +19,25 @@ use Symfony\Component\Routing\Annotation\Route;
*/
class AdminController extends AbstractController
{
/**
* @Route("/{_locale}/admin/accompanying-course", name="chill_accompanying-course_admin_index")
*/
#[Route(path: '/{_locale}/admin/accompanying-course', name: 'chill_accompanying-course_admin_index')]
public function indexAccompanyingCourseAdminAction()
{
return $this->render('@ChillPerson/Admin/indexAccompanyingCourse.html.twig');
}
/**
* @Route("/{_locale}/admin/household", name="chill_household_admin_index")
*/
#[Route(path: '/{_locale}/admin/household', name: 'chill_household_admin_index')]
public function indexHouseholdAdminAction()
{
return $this->render('@ChillPerson/Admin/indexHousehold.html.twig');
}
/**
* @Route("/{_locale}/admin/person", name="chill_person_admin_index")
*/
#[Route(path: '/{_locale}/admin/person', name: 'chill_person_admin_index')]
public function indexPersonAdminAction()
{
return $this->render('@ChillPerson/Admin/indexPerson.html.twig');
}
/**
* @Route("/{_locale}/admin/social-work", name="chill_social-work_admin_index")
*/
#[Route(path: '/{_locale}/admin/social-work', name: 'chill_social-work_admin_index')]
public function indexSocialWorkAdminAction()
{
return $this->render('@ChillPerson/Admin/indexSocialWork.html.twig');
@@ -53,9 +45,8 @@ class AdminController extends AbstractController
/**
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/person_redirect_to_main", name="chill_person_admin_redirect_to_admin_index", options={null})
*/
#[Route(path: '/{_locale}/admin/person_redirect_to_main', name: 'chill_person_admin_redirect_to_admin_index', options: [null])]
public function redirectToAdminIndexAction()
{
return $this->redirectToRoute('chill_main_admin_central');

View File

@@ -34,11 +34,9 @@ class HouseholdApiController extends ApiController
public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route("/api/1.0/person/household/by-address-reference/{id}.json",
* name="chill_api_person_household_by_address_reference")
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
#[Route(path: '/api/1.0/person/household/by-address-reference/{id}.json', name: 'chill_api_person_household_by_address_reference')]
public function getHouseholdByAddressReference(AddressReference $addressReference): Response
{
$this->denyAccessUnlessGranted('ROLE_USER');
@@ -59,10 +57,8 @@ class HouseholdApiController extends ApiController
/**
* Add an address to a household.
*
* @Route("/api/1.0/person/household/{id}/address.{_format}", name="chill_api_single_household_address",
* methods={"POST"}, requirements={"_format": "json"})
*/
#[Route(path: '/api/1.0/person/household/{id}/address.{_format}', name: 'chill_api_single_household_address', methods: ['POST'], requirements: ['_format' => 'json'])]
public function householdAddressApi(Household $household, Request $request, string $_format): Response
{
$this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household);
@@ -104,15 +100,9 @@ class HouseholdApiController extends ApiController
}
/**
* @Route("/api/1.0/person/address/suggest/by-household/{household_id}.{_format}",
* name="chill_person_address_suggest_by_household",
* requirements={
* "_format": "json"
* }
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/api/1.0/person/address/suggest/by-household/{household_id}.{_format}', name: 'chill_person_address_suggest_by_household', requirements: ['_format' => 'json'])]
public function suggestAddressByHousehold(Household $household, string $_format)
{
// TODO add acl

View File

@@ -46,9 +46,7 @@ class HouseholdCompositionController extends AbstractController
private readonly UrlGeneratorInterface $urlGenerator
) {}
/**
* @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete")
*/
#[Route(path: '/{_locale}/person/household/{household_id}/composition/{composition_id}/delete', name: 'chill_person_household_composition_delete')]
public function deleteAction(Request $request, mixed $household_id, mixed $composition_id): Response
{
$composition = $this->householdCompositionRepository->find($composition_id);
@@ -95,9 +93,7 @@ class HouseholdCompositionController extends AbstractController
);
}
/**
* @Route("/{_locale}/person/household/{id}/composition/index", name="chill_person_household_composition_index")
*/
#[Route(path: '/{_locale}/person/household/{id}/composition/index', name: 'chill_person_household_composition_index')]
public function index(Household $household, Request $request): Response
{
if (!$this->security->isGranted(HouseholdVoter::SEE, $household)) {
@@ -122,9 +118,7 @@ class HouseholdCompositionController extends AbstractController
));
}
/**
* @Route("/{_locale}/person/household/{id}/composition/new", name="chill_person_household_composition_new")
*/
#[Route(path: '/{_locale}/person/household/{id}/composition/new', name: 'chill_person_household_composition_new')]
public function newAction(Household $household, Request $request): Response
{
if ($this->security->isGranted(HouseholdVoter::EDIT, $household)) {

View File

@@ -29,22 +29,15 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @Route("/{_locale}/person/household")
*/
#[Route(path: '/{_locale}/person/household')]
class HouseholdController extends AbstractController
{
public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route(
* "/{household_id}/accompanying-period",
* name="chill_person_household_accompanying_period",
* methods={"GET", "HEAD"}
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/{household_id}/accompanying-period', name: 'chill_person_household_accompanying_period', methods: ['GET', 'HEAD'])]
public function accompanyingPeriod(Request $request, Household $household)
{
$currentMembers = $household->getCurrentPersons();
@@ -92,14 +85,9 @@ class HouseholdController extends AbstractController
}
/**
* @Route(
* "/{household_id}/address/edit",
* name="chill_person_household_address_edit",
* methods={"GET", "HEAD", "POST"}
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/{household_id}/address/edit', name: 'chill_person_household_address_edit', methods: ['GET', 'HEAD', 'POST'])]
public function addressEdit(Request $request, Household $household)
{
// TODO ACL
@@ -119,14 +107,9 @@ class HouseholdController extends AbstractController
}
/**
* @Route(
* "/{household_id}/addresses",
* name="chill_person_household_addresses",
* methods={"GET", "HEAD"}
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/{household_id}/addresses', name: 'chill_person_household_addresses', methods: ['GET', 'HEAD'])]
public function addresses(Request $request, Household $household)
{
// TODO ACL
@@ -150,14 +133,9 @@ class HouseholdController extends AbstractController
}
/**
* @Route(
* "/{household_id}/address/move",
* name="chill_person_household_address_move",
* methods={"GET", "HEAD", "POST"}
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/{household_id}/address/move', name: 'chill_person_household_address_move', methods: ['GET', 'HEAD', 'POST'])]
public function addressMove(Request $request, Household $household)
{
// TODO ACL
@@ -171,14 +149,9 @@ class HouseholdController extends AbstractController
}
/**
* @Route(
* "/{household_id}/address/edit_valid_from",
* name="chill_person_household_address_valid_from_edit",
* methods={"GET", "HEAD", "POST"}
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/{household_id}/address/edit_valid_from', name: 'chill_person_household_address_valid_from_edit', methods: ['GET', 'HEAD', 'POST'])]
public function addressValidFromEdit(Request $request, Household $household)
{
$this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household);
@@ -228,14 +201,9 @@ class HouseholdController extends AbstractController
}
/**
* @Route(
* "/{household_id}/members/metadata/edit",
* name="chill_person_household_members_metadata_edit",
* methods={"GET", "POST"}
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/{household_id}/members/metadata/edit', name: 'chill_person_household_members_metadata_edit', methods: ['GET', 'POST'])]
public function editHouseholdMetadata(Request $request, Household $household)
{
// TODO ACL
@@ -260,14 +228,9 @@ class HouseholdController extends AbstractController
}
/**
* @Route(
* "/{household_id}/relationship",
* name="chill_person_household_relationship",
* methods={"GET", "HEAD"}
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/{household_id}/relationship', name: 'chill_person_household_relationship', methods: ['GET', 'HEAD'])]
public function showRelationship(Request $request, Household $household)
{
$jsonString = $this->serializer->serialize(
@@ -286,14 +249,9 @@ class HouseholdController extends AbstractController
}
/**
* @Route(
* "/{household_id}/summary",
* name="chill_person_household_summary",
* methods={"GET", "HEAD"}
* )
*
* @ParamConverter("household", options={"id": "household_id"})
*/
#[Route(path: '/{household_id}/summary', name: 'chill_person_household_summary', methods: ['GET', 'HEAD'])]
public function summary(Request $request, Household $household)
{
// TODO ACL

View File

@@ -47,12 +47,7 @@ class HouseholdMemberController extends ApiController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
/**
* @Route(
* "/{_locale}/person/household/member/{id}/edit",
* name="chill_person_household_member_edit"
* )
*/
#[Route(path: '/{_locale}/person/household/member/{id}/edit', name: 'chill_person_household_member_edit')]
public function editMembership(Request $request, HouseholdMember $member): Response
{
// TODO ACL
@@ -90,12 +85,8 @@ class HouseholdMemberController extends ApiController
* * household: the id of the destination household
* * allow_leave_without_household: if present, the editor will allow
* to leave household without joining another
*
* @Route(
* "/{_locale}/person/household/members/editor",
* name="chill_person_household_members_editor"
* )
*/
#[Route(path: '/{_locale}/person/household/members/editor', name: 'chill_person_household_members_editor')]
public function editor(Request $request)
{
$ids = $request->query->all('persons');
@@ -173,12 +164,7 @@ class HouseholdMemberController extends ApiController
]);
}
/**
* @Route(
* "/api/1.0/person/household/members/move.{_format}",
* name="chill_api_person_household_members_move"
* )
*/
#[Route(path: '/api/1.0/person/household/members/move.{_format}', name: 'chill_api_person_household_members_move')]
public function move(Request $request, mixed $_format): Response
{
try {

View File

@@ -31,9 +31,7 @@ class PersonAddressController extends AbstractController
*/
public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/create', name: 'chill_person_address_create', methods: ['POST'])]
public function createAction(mixed $person_id, Request $request)
{
$person = $this->managerRegistry->getManager()
@@ -88,9 +86,7 @@ class PersonAddressController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/edit", name="chill_person_address_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/{address_id}/edit', name: 'chill_person_address_edit')]
public function editAction(mixed $person_id, mixed $address_id)
{
$person = $this->managerRegistry->getManager()
@@ -118,9 +114,7 @@ class PersonAddressController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/list", name="chill_person_address_list")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/list', name: 'chill_person_address_list')]
public function listAction(mixed $person_id)
{
$person = $this->managerRegistry->getManager()
@@ -142,9 +136,7 @@ class PersonAddressController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/new", name="chill_person_address_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/new', name: 'chill_person_address_new')]
public function newAction(mixed $person_id)
{
$person = $this->managerRegistry->getManager()
@@ -171,9 +163,7 @@ class PersonAddressController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/{address_id}/update", name="chill_person_address_update")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/address/{address_id}/update', name: 'chill_person_address_update')]
public function updateAction(mixed $person_id, mixed $address_id, Request $request)
{
$person = $this->managerRegistry->getManager()

View File

@@ -36,11 +36,7 @@ class PersonApiController extends ApiController
$this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers'];
}
/**
* @Route("/api/1.0/person/creation/authorized-centers",
* name="chill_person_person_creation_authorized_centers"
* )
*/
#[Route(path: '/api/1.0/person/creation/authorized-centers', name: 'chill_person_person_creation_authorized_centers')]
public function authorizedCentersForCreation(): Response
{
$centers = $this->authorizedCenterOnPersonCreation->getCenters();
@@ -53,14 +49,7 @@ class PersonApiController extends ApiController
);
}
/**
* @Route("/api/1.0/person/config/alt_names.{_format}",
* name="chill_person_config_alt_names",
* requirements={
* "_format": "json"
* }
* )
*/
#[Route(path: '/api/1.0/person/config/alt_names.{_format}', name: 'chill_person_config_alt_names', requirements: ['_format' => 'json'])]
public function configAltNames(Request $request, string $_format): Response
{
$configAltNamesChoices = $this->configPersonAltNameHelper->getChoices();
@@ -83,15 +72,9 @@ class PersonApiController extends ApiController
}
/**
* @Route("/api/1.0/person/address/suggest/by-person/{person_id}.{_format}",
* name="chill_person_address_suggest_by_person",
* requirements={
* "_format": "json"
* }
* )
*
* @ParamConverter("person", options={"id": "person_id"})
*/
#[Route(path: '/api/1.0/person/address/suggest/by-person/{person_id}.{_format}', name: 'chill_person_address_suggest_by_person', requirements: ['_format' => 'json'])]
public function suggestAddress(Person $person, Request $request, string $_format): Response
{
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);

View File

@@ -49,9 +49,7 @@ final class PersonController extends AbstractController
private readonly EntityManagerInterface $em,
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general/edit", name="chill_person_general_edit")
*/
#[Route(path: '/{_locale}/person/{person_id}/general/edit', name: 'chill_person_general_edit')]
public function editAction(int $person_id, Request $request)
{
$person = $this->_getPerson($person_id);
@@ -116,14 +114,9 @@ final class PersonController extends AbstractController
}
/**
* @Route(
* "/{_locale}/person/household/{person_id}/history",
* name="chill_person_household_person_history",
* methods={"GET", "POST"}
* )
*
* @ParamConverter("person", options={"id": "person_id"})
*/
#[Route(path: '/{_locale}/person/household/{person_id}/history', name: 'chill_person_household_person_history', methods: ['GET', 'POST'])]
public function householdHistoryByPerson(Request $request, Person $person): Response
{
$this->denyAccessUnlessGranted(
@@ -146,14 +139,13 @@ final class PersonController extends AbstractController
/**
* Method for creating a new person.
*
*The controller register data from a previous post on the form, and
* The controller register data from a previous post on the form, and
* register it in the session.
*
* The next post compare the data with previous one and, if yes, show a
* review page if there are "alternate persons".
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/new", name="chill_person_new")
*/
#[Route(path: '/{_locale}/person/new', name: 'chill_person_new')]
public function newAction(Request $request): Response
{
$person = new Person();
@@ -248,9 +240,7 @@ final class PersonController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/general", name="chill_person_view")
*/
#[Route(path: '/{_locale}/person/{person_id}/general', name: 'chill_person_view')]
public function viewAction(int $person_id)
{
$person = $this->_getPerson($person_id);

View File

@@ -42,9 +42,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm", name="chill_person_duplicate_confirm")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/confirm', name: 'chill_person_duplicate_confirm')]
public function confirmAction(mixed $person1_id, mixed $person2_id, Request $request)
{
if ($person1_id === $person2_id) {
@@ -104,9 +102,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/find-manually", name="chill_person_find_manually_duplicate")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/find-manually', name: 'chill_person_find_manually_duplicate')]
public function findManuallyDuplicateAction(mixed $person_id, Request $request)
{
$person = $this->_getPerson($person_id);
@@ -155,9 +151,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate", name="chill_person_duplicate_not_duplicate")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/not-duplicate', name: 'chill_person_duplicate_not_duplicate')]
public function notDuplicateAction(mixed $person1_id, mixed $person2_id)
{
$user = $this->security->getUser();
@@ -190,9 +184,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate", name="chill_person_remove_duplicate_not_duplicate")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person1_id}/duplicate/{person2_id}/remove-not-duplicate', name: 'chill_person_remove_duplicate_not_duplicate')]
public function removeNotDuplicateAction(mixed $person1_id, mixed $person2_id)
{
[$person1, $person2] = $this->_getPersonsByPriority($person1_id, $person2_id);
@@ -214,9 +206,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/duplicate/view", name="chill_person_duplicate_view")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/duplicate/view', name: 'chill_person_duplicate_view')]
public function viewAction(mixed $person_id, PersonNotDuplicateRepository $personNotDuplicateRepository)
{
$person = $this->_getPerson($person_id);

View File

@@ -27,9 +27,7 @@ final class PersonResourceController extends AbstractController
{
public function __construct(private readonly PersonResourceRepository $personResourceRepository, private readonly PersonRepository $personRepository, private readonly EntityManagerInterface $em, private readonly TranslatorInterface $translator) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/delete", name="chill_person_resource_delete")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/{resource_id}/delete', name: 'chill_person_resource_delete')]
public function deleteAction(Request $request, mixed $person_id, mixed $resource_id): Response
{
$personOwner = $this->personRepository->find($person_id);
@@ -76,9 +74,7 @@ final class PersonResourceController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/{resource_id}/edit", name="chill_person_resource_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/{resource_id}/edit', name: 'chill_person_resource_edit')]
public function editAction(Request $request, mixed $resource_id, mixed $person_id): Response
{
$resource = $this->personResourceRepository->find($resource_id);
@@ -113,9 +109,7 @@ final class PersonResourceController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/list", name="chill_person_resource_list")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/list', name: 'chill_person_resource_list')]
public function listAction(Request $request, mixed $person_id)
{
$personOwner = $this->personRepository->find($person_id);
@@ -133,9 +127,7 @@ final class PersonResourceController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/resources/new", name="chill_person_resource_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/resources/new', name: 'chill_person_resource_new')]
public function newAction(Request $request, mixed $person_id)
{
$personOwner = $this->personRepository->find($person_id);

View File

@@ -41,9 +41,7 @@ class ReassignAccompanyingPeriodController extends AbstractController
{
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em) {}
/**
* @Route("/{_locale}/person/accompanying-periods/reassign", name="chill_course_list_reassign")
*/
#[Route(path: '/{_locale}/person/accompanying-periods/reassign', name: 'chill_course_list_reassign')]
public function listAction(Request $request): Response
{
if (!$this->security->isGranted(AccompanyingPeriodVoter::REASSIGN_BULK)) {

View File

@@ -29,9 +29,7 @@ final class ResidentialAddressController extends AbstractController
{
public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route("/{_locale}/person/residential-address/{id}/delete", name="chill_person_residential_address_delete")
*/
#[Route(path: '/{_locale}/person/residential-address/{id}/delete', name: 'chill_person_residential_address_delete')]
public function deleteAction(Request $request, ResidentialAddress $residentialAddress): Response
{
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $residentialAddress->getPerson());
@@ -57,9 +55,7 @@ final class ResidentialAddressController extends AbstractController
]);
}
/**
* @Route("/{_locale}/person/residential-address/{id}/edit", name="chill_person_residential_address_edit")
*/
#[Route(path: '/{_locale}/person/residential-address/{id}/edit', name: 'chill_person_residential_address_edit')]
public function editAction(Request $request, ResidentialAddress $residentialAddress): Response
{
if ($request->query->has('kind')) {
@@ -93,9 +89,7 @@ final class ResidentialAddressController extends AbstractController
]);
}
/**
* @Route("/{_locale}/person/{id}/residential-address/list", name="chill_person_residential_address_list")
*/
#[Route(path: '/{_locale}/person/{id}/residential-address/list', name: 'chill_person_residential_address_list')]
public function listAction(Request $request, Person $person): Response
{
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
@@ -108,9 +102,7 @@ final class ResidentialAddressController extends AbstractController
]);
}
/**
* @Route("/{_locale}/person/{id}/residential-address/new", name="chill_person_residential_address_new")
*/
#[Route(path: '/{_locale}/person/{id}/residential-address/new', name: 'chill_person_residential_address_new')]
public function newAction(Request $request, Person $person): Response
{
$residentialAddress = new ResidentialAddress();

View File

@@ -25,15 +25,9 @@ class SocialWorkEvaluationApiController extends AbstractController
public function __construct(private readonly PaginatorFactory $paginatorFactory) {}
/**
* @Route("/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json",
* name="chill_person_evaluation_index_by_social_action",
* requirements={
* "_format": "json"
* }
* )
*
* @ParamConverter("action", options={"id": "action_id"})
*/
#[Route(path: '/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json', name: 'chill_person_evaluation_index_by_social_action', requirements: ['_format' => 'json'])]
public function listEvaluationBySocialAction(SocialAction $action): Response
{
$evaluations = $action->getEvaluations()->filter(static fn (Evaluation $eval) => $eval->isActive());

View File

@@ -24,9 +24,7 @@ class TimelinePersonController extends AbstractController
{
public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/timeline", name="chill_person_timeline")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/person/{person_id}/timeline', name: 'chill_person_timeline')]
public function personAction(Request $request, mixed $person_id)
{
$person = $this->managerRegistry

View File

@@ -23,9 +23,7 @@ class UserAccompanyingPeriodController extends AbstractController
{
public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly PaginatorFactory $paginatorFactory) {}
/**
* @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user")
*/
#[Route(path: '/{_locale}/person/accompanying-periods/my', name: 'chill_person_accompanying_period_user')]
public function listAction(Request $request): Response
{
$active = $request->query->getBoolean('active', true);
@@ -56,9 +54,7 @@ class UserAccompanyingPeriodController extends AbstractController
]);
}
/**
* @Route("/{_locale}/person/accompanying-periods/my/drafts", name="chill_person_accompanying_period_draft_user")
*/
#[Route(path: '/{_locale}/person/accompanying-periods/my/drafts', name: 'chill_person_accompanying_period_draft_user')]
public function listDraftsAction(): Response
{
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']);

View File

@@ -58,18 +58,14 @@ use UnexpectedValueException;
*
* @ORM\Table(name="chill_person_accompanying_period")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period": AccompanyingPeriod::class
* })
*
* @Assert\GroupSequenceProvider
*
* @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
*
* @LocationValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
*
* @ConfidentialCourseMustHaveReferrer(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period' => AccompanyingPeriod::class])]
#[Assert\GroupSequenceProvider]
class AccompanyingPeriod implements
GroupSequenceProviderInterface,
HasCentersInterface,
@@ -144,11 +140,9 @@ class AccompanyingPeriod implements
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
*
* @Groups({"read", "write"})
*
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
*/
#[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
private ?Location $administrativeLocation = null;
/**
@@ -160,17 +154,10 @@ class AccompanyingPeriod implements
/**
* @ORM\Column(type="date", nullable=true)
*
* @Groups({"read", "write", "docgen:read"})
*
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED})
*
* @Assert\GreaterThanOrEqual(
* propertyPath="openingDate",
* groups={AccompanyingPeriod::STEP_CLOSED},
* message="The closing date must be later than the date of creation"
* )
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
#[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')]
private ?\DateTime $closingDate = null;
/**
@@ -178,11 +165,9 @@ class AccompanyingPeriod implements
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read", "write"})
*
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED})
*/
#[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
private ?ClosingMotive $closingMotive = null;
/**
@@ -194,40 +179,35 @@ class AccompanyingPeriod implements
*
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
*
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_DRAFT})
*
* @var Collection<Comment>
*/
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])]
private Collection $comments;
/**
* @ORM\Column(type="boolean", options={"default": false})
*
* @Groups({"read", "write", "docgen:read"})
*/
#[Groups(['read', 'write', 'docgen:read'])]
private bool $confidential = false;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?User $createdBy = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*
* @Groups({"read", "write", "docgen:read"})
*/
#[Groups(['read', 'write', 'docgen:read'])]
private bool $emergency = false;
/**
@@ -236,29 +216,24 @@ class AccompanyingPeriod implements
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
*
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
*/
#[Groups(['read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
private ?string $intensity = self::INTENSITY_OCCASIONAL;
/**
* @ORM\ManyToOne(
* targetEntity=UserJob::class
* )
*
* @Groups({"read", "write"})
*
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
*/
#[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
private ?UserJob $job = null;
/**
@@ -271,24 +246,19 @@ class AccompanyingPeriod implements
/**
* @ORM\Column(type="date")
*
* @Groups({"read", "write", "docgen:read"})
*
* @Assert\LessThan(value="tomorrow", groups={AccompanyingPeriod::STEP_CONFIRMED})
*
* @Assert\LessThanOrEqual(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED})
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\LessThan(value: 'tomorrow', groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[Assert\LessThanOrEqual(propertyPath: 'closingDate', groups: [AccompanyingPeriod::STEP_CONFIRMED])]
private ?\DateTime $openingDate = null;
/**
* @ORM\ManyToOne(targetEntity=Origin::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read", "write"})
*
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
*/
#[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
private ?Origin $origin = null;
/**
@@ -296,12 +266,11 @@ class AccompanyingPeriod implements
* mappedBy="accompanyingPeriod", orphanRemoval=true,
* cascade={"persist", "refresh", "remove", "merge", "detach"})
*
* @Groups({"read", "docgen:read"})
*
* @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
*
* @var Collection<AccompanyingPeriodParticipation>
*/
#[Groups(['read', 'docgen:read'])]
private Collection $participations;
/**
@@ -318,26 +287,23 @@ class AccompanyingPeriod implements
* cascade={"persist"},
* )
*
* @Groups({"read"})
*
* @ORM\JoinColumn(onDelete="SET NULL")
*/
#[Groups(['read'])]
private ?Comment $pinnedComment = null;
private bool $preventUserIsChangedNotification = false;
/**
* @ORM\Column(type="text")
*
* @Groups({"read", "write"})
*/
#[Groups(['read', 'write'])]
private string $remark = '';
/**
* @ORM\Column(type="boolean", options={"default": false})
*
* @Groups({"read", "write", "docgen:read"})
*/
#[Groups(['read', 'write', 'docgen:read'])]
private bool $requestorAnonymous = false;
/**
@@ -364,10 +330,9 @@ class AccompanyingPeriod implements
* orphanRemoval=true
* )
*
* @Groups({"read", "docgen:read"})
*
* @ResourceDuplicateCheck(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED, "Default", "default"})
*/
#[Groups(['read', 'docgen:read'])]
private Collection $resources;
/**
@@ -383,11 +348,9 @@ class AccompanyingPeriod implements
* joinColumns={@ORM\JoinColumn(name="accompanying_period_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")}
* )
*
* @Groups({"read", "docgen:read"})
*
* @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must be associated to at least one scope")
*/
#[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')]
private Collection $scopes;
/**
@@ -400,20 +363,17 @@ class AccompanyingPeriod implements
* @ORM\JoinTable(
* name="chill_person_accompanying_period_social_issues"
* )
*
* @Groups({"read", "docgen:read"})
*
* @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must contains at least one social issue")
*/
#[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')]
private Collection $socialIssues;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*
* @Groups({"read"})
*
* @var AccompanyingPeriod::STEP_*
*/
#[Groups(['read'])]
private ?string $step = self::STEP_DRAFT;
/**
@@ -440,9 +400,8 @@ class AccompanyingPeriod implements
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read", "write", "docgen:read"})
*/
#[Groups(['read', 'write', 'docgen:read'])]
private ?User $user = null;
/**
@@ -469,9 +428,8 @@ class AccompanyingPeriod implements
* targetEntity=AccompanyingPeriodWork::class,
* mappedBy="accompanyingPeriod"
* )
*
* @Assert\Valid(traverse=true)
*/
#[Assert\Valid(traverse: true)]
private Collection $works;
/**
@@ -749,10 +707,9 @@ class AccompanyingPeriod implements
}
/**
* @Groups({"read"})
*
* @return ReadableCollection<(int|string), Comment>
*/
#[Groups(['read'])]
public function getComments(): ReadableCollection
{
$pinnedComment = $this->pinnedComment;
@@ -775,9 +732,7 @@ class AccompanyingPeriod implements
return $this->createdBy;
}
/**
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
public function getCurrentParticipations(): ReadableCollection
{
return $this->getOpenParticipations();
@@ -826,9 +781,8 @@ class AccompanyingPeriod implements
/**
* Get the location, taking precedence into account.
*
* @Groups({"read"})
*/
#[Groups(['read'])]
public function getLocation(?\DateTimeImmutable $at = null): ?Address
{
if ($this->getPersonLocation() instanceof Person) {
@@ -849,10 +803,9 @@ class AccompanyingPeriod implements
/**
* Get where the location is.
*
* @Groups({"read"})
*
* @return 'person'|'address'|'none'
*/
#[Groups(['read'])]
public function getLocationStatus(): string
{
if ($this->getPersonLocation() instanceof Person) {
@@ -949,9 +902,7 @@ class AccompanyingPeriod implements
);
}
/**
* @Groups({"read"})
*/
#[Groups(['read'])]
public function getPersonLocation(): ?Person
{
return $this->personLocation;
@@ -971,9 +922,7 @@ class AccompanyingPeriod implements
);
}
/**
* @Groups({"read"})
*/
#[Groups(['read'])]
public function getPinnedComment(): ?Comment
{
return $this->pinnedComment;
@@ -1026,9 +975,7 @@ class AccompanyingPeriod implements
return $this->remark;
}
/**
* @Groups({"read"})
*/
#[Groups(['read'])]
public function getRequestor(): Person|ThirdParty|null
{
return $this->requestorPerson ?? $this->requestorThirdParty;
@@ -1254,9 +1201,7 @@ class AccompanyingPeriod implements
return $this;
}
/**
* @Groups({"write"})
*/
#[Groups(['write'])]
public function setAddressLocation(?Address $addressLocation = null): self
{
if ($this->addressLocation !== $addressLocation) {
@@ -1369,9 +1314,7 @@ class AccompanyingPeriod implements
return $this;
}
/**
* @Groups({"write"})
*/
#[Groups(['write'])]
public function setPersonLocation(?Person $person = null): self
{
if ($this->personLocation !== $person) {
@@ -1391,9 +1334,7 @@ class AccompanyingPeriod implements
return $this;
}
/**
* @Groups({"write"})
*/
#[Groups(['write'])]
public function setPinnedComment(?Comment $comment = null): self
{
if (null !== $this->pinnedComment) {
@@ -1421,9 +1362,8 @@ class AccompanyingPeriod implements
* @param $requestor Person|ThirdParty
*
* @throw UnexpectedValueException if the requestor is not a Person or ThirdParty
*
* @Groups({"write"})
*/
#[Groups(['write'])]
public function setRequestor($requestor): self
{
if ($requestor instanceof Person) {

View File

@@ -33,23 +33,16 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_work")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "accompanying_period_work": AccompanyingPeriodWork::class
* }
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work' => AccompanyingPeriodWork::class])]
class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*
* @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"})
*
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])]
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
@@ -60,57 +53,46 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* orphanRemoval=true
* )
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @ORM\OrderBy({"startDate": "DESC", "id": "DESC"})
*
* @var Collection<AccompanyingPeriodWorkEvaluation>
*
* @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private Collection $accompanyingPeriodWorkEvaluations;
/**
* @ORM\Column(type="datetime_immutable")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\Column(type="boolean")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private bool $createdAutomatically = false;
/**
* @ORM\Column(type="text")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private string $createdAutomaticallyReason = '';
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private ?User $createdBy = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"accompanying_period_work:create"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*
* @Assert\GreaterThanOrEqual(propertyPath="startDate",
* message="accompanying_course_work.The endDate should be greater or equal than the start date"
* )
*/
#[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'accompanying_course_work.The endDate should be greater or equal than the start date')]
private ?\DateTimeImmutable $endDate = null;
/**
@@ -122,20 +104,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* cascade={"persist"},
* orphanRemoval=true
* )
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work:edit"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
private Collection $goals;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work:edit"})
*
* In schema : traitant
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
private ?ThirdParty $handlingThierParty = null;
/**
@@ -144,16 +120,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light", "read:evaluation:include-work"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'read:evaluation:include-work'])]
private ?int $id = null;
/**
* @ORM\Column(type="text")
*
* @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"})
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit', 'docgen:read'])]
private string $note = '';
/**
@@ -162,18 +136,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\ManyToMany(targetEntity=Person::class)
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"accompanying_period_work:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])]
private Collection $persons;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
*
* @Serializer\Groups({"read", "accompanying_period_work:edit"})
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
private PrivateCommentEmbeddable $privateComment;
/**
@@ -189,29 +159,22 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work:edit"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
private Collection $results;
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class)
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Serializer\Groups({"accompanying_period_work:create"})
*
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:create'])]
private ?SocialAction $socialAction = null;
/**
* @ORM\Column(type="date_immutable")
*
* @Serializer\Groups({"accompanying_period_work:create"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private ?\DateTimeImmutable $startDate = null;
/**
@@ -222,35 +185,30 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
*
* In schema : intervenants
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work:edit"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
private Collection $thirdParties;
/**
* @ORM\Column(type="datetime_immutable")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?User $updatedBy = null;
/**
* @ORM\Column(type="integer", nullable=false, options={"default": 1})
*
* @Serializer\Groups({"read", "accompanying_period_work:edit"})
*
* @ORM\Version
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
private int $version = 1;
public function __construct()
@@ -394,11 +352,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
/**
* @return ReadableCollection<int, User>
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"accompanying_period_work:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])]
public function getReferrers(): ReadableCollection
{
$users = $this->referrersHistory

View File

@@ -25,11 +25,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_work_evaluation")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_work_evaluation": AccompanyingPeriodWorkEvaluation::class,
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation' => AccompanyingPeriodWorkEvaluation::class])]
class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface
{
/**
@@ -38,35 +35,29 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
* inversedBy="accompanyingPeriodWorkEvaluations"
* )
*
* @Serializer\Groups({"read:evaluation:include-work"})
*
* @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"})
*/
#[Serializer\Groups(['read:evaluation:include-work'])]
private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private string $comment = '';
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?User $createdBy = null;
/**
@@ -83,29 +74,23 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
*
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
*
* @Serializer\Groups({"read"})
*
* @var Collection<AccompanyingPeriodWorkEvaluationDocument>
*/
#[Serializer\Groups(['read'])]
private Collection $documents;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(
* targetEntity=Evaluation::class
* )
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work_evaluation:create'])]
private ?Evaluation $evaluation = null;
/**
@@ -114,9 +99,8 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
@@ -125,63 +109,46 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
*
* This data is not persisted into database, but will appears on the data
* normalized during the same request (like PUT/PATCH request)
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private $key;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?\DateTimeImmutable $maxDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?User $updatedBy = null;
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?\DateInterval $warningInterval = null;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?int $timeSpent = null;
public function __construct()
@@ -270,9 +237,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
return $this->updatedBy;
}
/**
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
public function getWarningDate(): ?\DateTimeImmutable
{
if (null === $this->getEndDate() || null === $this->getWarningInterval()) {

View File

@@ -23,11 +23,8 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_work_evaluation_document")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_work_evaluation_document": AccompanyingPeriodWorkEvaluationDocument::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation_document' => AccompanyingPeriodWorkEvaluationDocument::class])]
class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doctrine\Model\TrackCreationInterface, \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface
{
use TrackCreationTrait;
@@ -52,10 +49,8 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
* @internal the default name exceeds 64 characters, we must set manually:
*
* @ORM\SequenceGenerator(sequenceName="chill_person_social_work_eval_doc_id_seq", allocationSize=1, initialValue=1000)
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])]
private ?int $id = null;
/**
@@ -64,43 +59,31 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
*
* This data is not persisted into database, but will appears on the data
* normalized during the same request (like PUT/PATCH request)
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private $key;
/**
* @ORM\ManyToOne(
* targetEntity=StoredObject::class,
* )
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*
* @Assert\Valid
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
#[Assert\Valid]
private ?StoredObject $storedObject = null;
/**
* @ORM\ManyToOne(
* targetEntity=DocGeneratorTemplate::class
* )
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])]
private ?DocGeneratorTemplate $template = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?string $title = '';
public function getAccompanyingPeriodWorkEvaluation(): ?AccompanyingPeriodWorkEvaluation

View File

@@ -22,14 +22,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "accompanying_period_work_goal": AccompanyingPeriodWorkGoal::class
* }
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_goal' => AccompanyingPeriodWorkGoal::class])]
class AccompanyingPeriodWorkGoal
{
/**
@@ -39,10 +33,8 @@ class AccompanyingPeriodWorkGoal
/**
* @ORM\ManyToOne(targetEntity=Goal::class)
*
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
private ?Goal $goal = null;
/**
@@ -51,17 +43,14 @@ class AccompanyingPeriodWorkGoal
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="text")
*
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read'])]
private string $note = '';
/**
@@ -70,10 +59,8 @@ class AccompanyingPeriodWorkGoal
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
*
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
private Collection $results;
public function __construct()

View File

@@ -47,18 +47,16 @@ class ClosingMotive
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private array $name = [];
/**

View File

@@ -24,11 +24,8 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_comment")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_comment": Comment::class
* })
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_comment' => Comment::class])]
class Comment implements TrackCreationInterface, TrackUpdateInterface
{
/**
@@ -42,29 +39,24 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="text", nullable=false, options={"default":""})
*
* @Groups({"read", "write", "docgen:read"})
*
* @Assert\NotBlank
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank]
#[Assert\NotNull]
private string $content = '';
/**
* @ORM\Column(type="datetime")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?User $creator = null;
/**
@@ -73,25 +65,22 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="datetime")
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?\DateTimeInterface $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?User $updatedBy = null;
public function getAccompanyingPeriod(): ?AccompanyingPeriod

View File

@@ -18,13 +18,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_origin")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "origin": Origin::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['origin' => Origin::class])]
class Origin
{
/**
@@ -33,25 +28,22 @@ class Origin
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private array $label = [];
/**
* @ORM\Column(type="date_immutable", nullable=true)
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?\DateTimeImmutable $noActiveAfter = null;
public function getId(): ?int

View File

@@ -31,11 +31,12 @@ use Symfony\Component\Serializer\Annotation\Groups;
* @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"})
* }
* )
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_resource": Resource::class
* })
* @ORM\UniqueConstraint(name="person_unique", columns={"person_id", "accompanyingperiod_id"}),
* @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"})
* }
* )
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_resource' => Resource::class])]
class Resource
{
/**
@@ -50,9 +51,8 @@ class Resource
/**
* @ORM\Column(type="text", nullable=true)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?string $comment = '';
/**
@@ -61,27 +61,24 @@ class Resource
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?ThirdParty $thirdParty = null;
public function getAccompanyingPeriod(): ?AccompanyingPeriod
@@ -104,9 +101,7 @@ class Resource
return $this->person;
}
/**
* @Groups({"read"})
*/
#[Groups(['read'])]
public function getResource(): Person|ThirdParty|null
{
return $this->person ?? $this->thirdParty;

View File

@@ -21,18 +21,14 @@ use Symfony\Component\Serializer\Annotation\Groups;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_participation")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_participation": AccompanyingPeriodParticipation::class
* })
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_participation' => AccompanyingPeriodParticipation::class])]
class AccompanyingPeriodParticipation
{
/**
* @ORM\Column(type="date", nullable=true)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?\DateTime $endDate = null;
/**
@@ -41,16 +37,14 @@ class AccompanyingPeriodParticipation
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="date", nullable=false)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?\DateTime $startDate = null;
public function __construct(/**
@@ -59,12 +53,11 @@ class AccompanyingPeriodParticipation
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false)
*/
private ?AccompanyingPeriod $accompanyingPeriod, /**
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations")
*
* @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false)
*
* @Groups({"read", "docgen:read"})
*/
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations")
*
* @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false)
*/
#[Groups(['read', 'docgen:read'])]
private ?Person $person
) {
$this->startDate = new \DateTime('now');

View File

@@ -32,12 +32,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
* name="chill_person_household"
* )
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "household": Household::class
* })
*
* @MaxHolder(groups={"household_memberships"})
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household' => Household::class])]
class Household
{
/**
@@ -52,9 +49,8 @@ class Household
* @ORM\JoinTable(name="chill_person_household_to_addresses")
*
* @ORM\OrderBy({"validFrom": "DESC", "id": "DESC"})
*
* @Serializer\Groups({"write"})
*/
#[Serializer\Groups(['write'])]
private Collection $addresses;
/**
@@ -73,9 +69,8 @@ class Household
* )
*
* @ORM\OrderBy({"startDate": "DESC"})
*
* @Assert\Valid(traverse=true, groups={"household_composition"})
*/
#[Assert\Valid(traverse: true, groups: ['household_composition'])]
private Collection&Selectable $compositions;
/**
@@ -84,9 +79,8 @@ class Household
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
@@ -96,23 +90,20 @@ class Household
* targetEntity=HouseholdMember::class,
* mappedBy="household"
* )
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private Collection $members;
/**
* @ORM\Column(type="boolean", name="waiting_for_birth", options={"default": false})
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private bool $waitingForBirth = false;
/**
* @ORM\Column(type="date_immutable", name="waiting_for_birth_date", nullable=true, options={"default": null})
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private ?\DateTimeImmutable $waitingForBirthDate = null;
public function __construct()
@@ -159,8 +150,6 @@ class Household
* By default, the addresses are ordered by date, descending (the most
* recent first).
*
* @Assert\Callback(methods={"validate"})
*
* @return Collection<Address>
*/
public function getAddresses(): Collection
@@ -209,11 +198,8 @@ class Household
return $this->compositions;
}
/**
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\SerializedName("current_address")
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Serializer\SerializedName('current_address')]
public function getCurrentAddress(?\DateTime $at = null): ?Address
{
$at ??= new \DateTime('today');
@@ -229,11 +215,8 @@ class Household
return null;
}
/**
* @Serializer\Groups({"docgen:read"})
*
* @Serializer\SerializedName("current_composition")
*/
#[Serializer\Groups(['docgen:read'])]
#[Serializer\SerializedName('current_composition')]
public function getCurrentComposition(?\DateTimeImmutable $at = null): ?HouseholdComposition
{
$at ??= new \DateTimeImmutable('today');
@@ -259,9 +242,7 @@ class Household
return null;
}
/**
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
public function getCurrentMembers(?\DateTimeImmutable $now = null): Collection
{
return $this->getMembers()->matching($this->buildCriteriaCurrentMembers($now));
@@ -281,11 +262,9 @@ class Household
* get current members ids.
*
* Used in serialization
*
* @Serializer\Groups({"read"})
*
* @Serializer\SerializedName("current_members_id")
*/
#[Serializer\Groups(['read'])]
#[Serializer\SerializedName('current_members_id')]
public function getCurrentMembersIds(?\DateTimeImmutable $now = null): ReadableCollection
{
return $this->getCurrentMembers($now)->map(
@@ -606,9 +585,8 @@ class Household
* This will force the startDate's address on today.
*
* Used on household creation.
*
* @Serializer\Groups({"create"})
*/
#[Serializer\Groups(['create'])]
public function setForceAddress(Address $address)
{
$address->setValidFrom(new \DateTime('today'));
@@ -629,6 +607,7 @@ class Household
return $this;
}
#[Assert\Callback]
public function validate(ExecutionContextInterface $context, $payload)
{
$addresses = $this->getAddresses();

View File

@@ -26,11 +26,8 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Table(
* name="chill_person_household_composition"
* )
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "household_composition_type": HouseholdCompositionType::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])]
class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
@@ -44,11 +41,9 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Assert\GreaterThanOrEqual(propertyPath="startDate", groups={"Default", "household_composition"})
*
* @Serializer\Groups({"docgen:read"})
*/
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])]
private ?\DateTimeImmutable $endDate = null;
/**
@@ -62,9 +57,8 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa
* @ORM\ManyToOne(targetEntity=HouseholdCompositionType::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private ?HouseholdCompositionType $householdCompositionType = null;
/**
@@ -73,29 +67,23 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="integer", nullable=true, options={"default": null})
*
* @Assert\NotNull
*
* @Assert\GreaterThanOrEqual(0, groups={"Default", "household_composition"})
*
* @Serializer\Groups({"docgen:read"})
*/
#[Assert\NotNull]
#[Assert\GreaterThanOrEqual(0, groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])]
private ?int $numberOfChildren = null;
/**
* @ORM\Column(type="date_immutable", nullable=false)
*
* @Assert\NotNull(groups={"Default", "household_composition"})
*
* @Serializer\Groups({"docgen:read"})
*/
#[Assert\NotNull(groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])]
private ?\DateTimeImmutable $startDate = null;
public function __construct()

View File

@@ -20,11 +20,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Table(
* name="chill_person_household_composition_type"
* )
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "household_composition_type": HouseholdCompositionType::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])]
class HouseholdCompositionType
{
/**
@@ -38,18 +35,16 @@ class HouseholdCompositionType
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private array $label = [];
public function getId(): ?int

View File

@@ -27,40 +27,30 @@ class HouseholdMember
{
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?string $comment = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Assert\GreaterThanOrEqual(
* propertyPath="startDate",
* message="household_membership.The end date must be after start date",
* groups={"household_memberships"}
* )
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'household_membership.The end date must be after start date', groups: ['household_memberships'])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private bool $holder = false;
/**
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Household\Household"
* )
*
* @Assert\Valid(groups={"household_memberships"})
*
* @Assert\NotNull(groups={"household_memberships"})
*/
#[Assert\Valid(groups: ['household_memberships'])]
#[Assert\NotNull(groups: ['household_memberships'])]
private ?Household $household = null;
/**
@@ -69,9 +59,8 @@ class HouseholdMember
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
@@ -79,21 +68,17 @@ class HouseholdMember
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\Context({"docgen:person:with-household": false})
*
* @Assert\Valid(groups={"household_memberships"})
*
* @Assert\NotNull(groups={"household_memberships"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\Valid(groups: ['household_memberships'])]
#[Assert\NotNull(groups: ['household_memberships'])]
private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity=Position::class)
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?Position $position = null;
/**
@@ -103,11 +88,9 @@ class HouseholdMember
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Assert\NotNull(groups={"household_memberships"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\NotNull(groups: ['household_memberships'])]
private ?\DateTimeImmutable $startDate = null;
public function getComment(): ?string
@@ -140,9 +123,7 @@ class HouseholdMember
return $this->position;
}
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public function getShareHousehold(): ?bool
{
return $this->shareHousehold;

View File

@@ -18,18 +18,14 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_household_position")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "household_position": Position::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_position' => Position::class])]
class Position
{
/**
* @ORM\Column(type="boolean")
*
* @Serializer\Groups({ "read" })
*/
#[Serializer\Groups(['read'])]
private bool $allowHolder = false;
/**
@@ -38,32 +34,28 @@ class Position
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private array $label = [];
/**
* @ORM\Column(type="float")
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private float $ordering = 0.00;
/**
* @ORM\Column(type="boolean")
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private bool $shareHouseHold = true;
public function getAllowHolder(): bool

View File

@@ -62,19 +62,25 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
* columns={"birthdate"}
* )
* })
* @ORM\Index(
* name="person_names",
* columns={"firstName", "lastName"}
* ),
* @ORM\Index(
* name="person_birthdate",
* columns={"birthdate"}
* )
* })
*
* @ORM\HasLifecycleCallbacks
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "person": Person::class
* })
*
* @PersonHasCenter
*
* @HouseholdMembershipSequential(
* groups={"household_memberships"}
* )
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['person' => Person::class])]
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable
{
final public const BOTH_GENDER = 'both';
@@ -282,35 +288,27 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The person's deathdate.
*
* @ORM\Column(type="date_immutable", nullable=true)
*
* @Assert\Date
*
* @Assert\GreaterThanOrEqual(propertyPath="birthdate")
*
* @Assert\LessThanOrEqual("today")
*/
#[Assert\Date]
#[Assert\GreaterThanOrEqual(propertyPath: 'birthdate')]
#[Assert\LessThanOrEqual('today')]
private ?\DateTimeImmutable $deathdate = null;
/**
* The person's email.
*
* @ORM\Column(type="text", nullable=true)
*
* @Assert\Email()
*/
#[Assert\Email]
private ?string $email = '';
/**
* The person's first name.
*
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank(message="The firstname cannot be empty")
*
* @Assert\Length(
* max=255,
* )
*/
#[Assert\NotBlank(message: 'The firstname cannot be empty')]
#[Assert\Length(max: 255)]
private string $firstName = '';
/**
@@ -325,9 +323,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The person's gender.
*
* @ORM\Column(type="string", length=9, nullable=true)
*
* @Assert\NotNull(message="The gender must be set")
*/
#[Assert\NotNull(message: 'The gender must be set')]
private ?string $gender = null;
/**
@@ -374,13 +371,9 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The person's last name.
*
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank(message="The lastname cannot be empty")
*
* @Assert\Length(
* max=255,
* )
*/
#[Assert\NotBlank(message: 'The lastname cannot be empty')]
#[Assert\Length(max: 255)]
private string $lastName = '';
/**
@@ -403,9 +396,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The date of the last marital status change of the person.
*
* @ORM\Column(type="date", nullable=true)
*
* @Assert\Date
*/
#[Assert\Date]
private ?\DateTime $maritalStatusDate = null;
/**
@@ -451,11 +443,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* cascade={"persist", "remove", "merge", "detach"},
* orphanRemoval=true
* )
*
* @Assert\Valid(
* traverse=true,
* )
*/
#[Assert\Valid(traverse: true)]
private Collection $otherPhoneNumbers;
/**
@@ -1410,11 +1399,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* Validation callback that checks if the accompanying periods are valid.
*
* This method add violation errors.
*
* @Assert\Callback(
* groups={"accompanying_period_consistent"}
* )
*/
#[Assert\Callback(groups: ['accompanying_period_consistent'])]
public function isAccompanyingPeriodValid(ExecutionContextInterface $context)
{
$r = $this->checkAccompanyingPeriodsAreNotCollapsing();
@@ -1439,11 +1425,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* two addresses with the same validFrom date).
*
* This method add violation errors.
*
* @Assert\Callback(
* groups={"addresses_consistent"}
* )
*/
#[Assert\Callback(groups: ['addresses_consistent'])]
public function isAddressesValid(ExecutionContextInterface $context)
{
if ($this->hasTwoAdressWithSameValidFromDate()) {

View File

@@ -28,11 +28,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_resource")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "personResource": personResource::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['personResource' => PersonResource::class])]
class PersonResource implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
@@ -41,16 +38,14 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private CommentEmbeddable $comment;
/**
* @ORM\Column(type="text", nullable=true)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?string $freeText = null;
/**
@@ -59,18 +54,16 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=PersonResourceKind::class, inversedBy="personResources")
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?PersonResourceKind $kind = null;
/**
@@ -79,9 +72,8 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?Person $person = null;
/**
@@ -90,18 +82,16 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="resources")
*
* @ORM\JoinColumn(nullable=false)
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?Person $personOwner = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class, inversedBy="personResources")
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?ThirdParty $thirdParty = null;
public function __construct()
@@ -142,9 +132,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
return $this->personOwner;
}
/**
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
public function getResourceKind(): string
{
if ($this->getPerson() instanceof Person) {
@@ -234,9 +222,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
return $this;
}
/**
* @Assert\Callback
*/
#[Assert\Callback]
public function validate(ExecutionContextInterface $context, mixed $payload)
{
if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) {

View File

@@ -27,9 +27,8 @@ class PersonResourceKind
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private ?int $id = null;
/**
@@ -40,10 +39,9 @@ class PersonResourceKind
/**
* @ORM\Column(type="json", length=255)
*
* @Serializer\Groups({"docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private array $title;
public function getId(): ?int

View File

@@ -31,9 +31,8 @@ class ResidentialAddress
* @ORM\ManyToOne(targetEntity=Address::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?Address $address = null;
/**
@@ -43,9 +42,8 @@ class ResidentialAddress
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?\DateTimeImmutable $endDate = null;
/**
@@ -53,19 +51,17 @@ class ResidentialAddress
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read"})
*
* @Context(normalizationContext={"groups": {"minimal"}})
*/
#[Groups(['read'])]
private ?Person $hostPerson = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?ThirdParty $hostThirdParty = null;
/**
@@ -86,9 +82,8 @@ class ResidentialAddress
/**
* @ORM\Column(type="datetime_immutable")
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?\DateTimeImmutable $startDate = null;
public function __construct()

View File

@@ -34,16 +34,14 @@ class PersonAltName
/**
* @ORM\Column(name="key", type="string", length=255)
*
* @Groups({"write"})
*/
#[Groups(['write'])]
private string $key = '';
/**
* @ORM\Column(name="label", type="text")
*
* @Groups({"write"})
*/
#[Groups(['write'])]
private string $label = '';
/**

View File

@@ -19,11 +19,8 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_relations")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "relation": Relation::class
* })
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['relation' => Relation::class])]
class Relation
{
/**
@@ -32,34 +29,30 @@ class Relation
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private bool $isActive = true;
/**
* @ORM\Column(type="json", nullable=true)
*
* @Serializer\Groups({"read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read'])]
private array $reverseTitle = [];
/**
* @ORM\Column(type="json", nullable=true)
*
* @Serializer\Groups({"read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read'])]
private array $title = [];
public function getId(): ?int

View File

@@ -30,12 +30,9 @@ use Symfony\Component\Validator\Constraints as Assert;
*
* @DiscriminatorColumn(name="relation_id", type="integer")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "relationship": Relationship::class
* })
*
* @RelationshipNoDuplicate
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['relationship' => Relationship::class])]
class Relationship implements TrackCreationInterface, TrackUpdateInterface
{
/**
@@ -54,11 +51,9 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Assert\NotNull
*
* @Serializer\Groups({"read", "write"})
*/
#[Assert\NotNull]
#[Serializer\Groups(['read', 'write'])]
private ?Person $fromPerson = null;
/**
@@ -67,43 +62,33 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Relation::class)
*
* @ORM\JoinColumn(nullable=false, name="relation_id", referencedColumnName="id")
*
* @Assert\NotNull
*
* @Serializer\Groups({"read", "write"})
*/
#[Assert\NotNull]
#[Serializer\Groups(['read', 'write'])]
private ?Relation $relation = null;
/**
* @ORM\Column(type="boolean")
*
* @Assert\Type(
* type="bool",
* message="This must be of type boolean"
* )
*
* @Serializer\Groups({"read", "write"})
*/
#[Assert\Type(type: 'bool', message: 'This must be of type boolean')]
#[Serializer\Groups(['read', 'write'])]
private bool $reverse;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Assert\NotNull
*
* @Serializer\Groups({"read", "write"})
*/
#[Assert\NotNull]
#[Serializer\Groups(['read', 'write'])]
private ?Person $toPerson = null;
/**

View File

@@ -21,11 +21,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_social_work_evaluation")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "social_work_evaluation": Evaluation::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_evaluation' => Evaluation::class])]
class Evaluation
{
/**
@@ -35,9 +32,8 @@ class Evaluation
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?\DateInterval $delay = null;
/**
@@ -46,16 +42,14 @@ class Evaluation
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?\DateInterval $notificationDelay = null;
/**
@@ -71,17 +65,15 @@ class Evaluation
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private array $title = [];
/**
* @ORM\Column(type="text", nullable=true)
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?string $url = null;
public function __construct()

View File

@@ -20,14 +20,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_social_work_goal")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "social_work_goal": Goal::class
* }
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_goal' => Goal::class])]
class Goal
{
/**
@@ -41,9 +35,8 @@ class Goal
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
@@ -65,10 +58,9 @@ class Goal
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private array $title = [];
public function __construct()

View File

@@ -23,14 +23,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_social_work_result")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "social_work_result": Result::class
* }
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_result' => Result::class])]
class Result
{
/**
@@ -65,9 +59,8 @@ class Result
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
@@ -80,10 +73,9 @@ class Result
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private array $title = [];
public function __construct()

View File

@@ -22,14 +22,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_social_action")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "social_work_social_action": SocialAction::class
* }
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_social_action' => SocialAction::class])]
class SocialAction
{
/**

View File

@@ -21,11 +21,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_social_issue")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "social_issue": SocialIssue::class
* })
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['social_issue' => SocialIssue::class])]
class SocialIssue
{
/**
@@ -68,9 +65,8 @@ class SocialIssue
/**
* @ORM\Column(type="json")
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private array $title = [];
public function __construct()

View File

@@ -19,7 +19,7 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
class PersonAltNameDataMapper implements DataMapperInterface
{
public function mapDataToForms($viewData, iterable $forms): void
public function mapDataToForms($viewData, \Traversable $forms): void
{
if (null === $viewData) {
return;
@@ -43,7 +43,7 @@ class PersonAltNameDataMapper implements DataMapperInterface
}
}
public function mapFormsToData(iterable $forms, &$viewData): void
public function mapFormsToData(\Traversable $forms, &$viewData): void
{
$mapIndexToKey = [];