ChillPersonBundle: Add numberOfDependents and numberOfDependentsWithDisabilities

This commit is contained in:
Christophe Siraut
2024-12-20 11:28:36 +01:00
parent 5f31473c90
commit fbdc0d32f0
15 changed files with 220 additions and 6 deletions

View File

@@ -33,9 +33,12 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\Exception;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
class HouseholdMemberController extends ApiController
{
private array $fields_visibility;
public function __construct(
private readonly UrlGeneratorInterface $generator,
private readonly TranslatorInterface $translator,
@@ -45,7 +48,10 @@ class HouseholdMemberController extends ApiController
private readonly Security $security,
private readonly PositionRepository $positionRepository,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
protected ParameterBagInterface $parameterBag,
) {
$this->fields_visibility = $parameterBag->get('chill_person.person_fields');
}
#[Route(path: '/{_locale}/person/household/member/{id}/edit', name: 'chill_person_household_member_edit')]
public function editMembership(Request $request, HouseholdMember $member): Response
@@ -144,6 +150,7 @@ class HouseholdMemberController extends ApiController
'allowHouseholdCreate' => $allowHouseholdCreate ?? true,
'allowHouseholdSearch' => $allowHouseholdSearch ?? true,
'allowLeaveWithoutHousehold' => $allowLeaveWithoutHousehold ?? $request->query->has('allow_leave_without_household'),
'displayDependents' => ('visible' == $this->fields_visibility['number_of_dependents']) ? true : false,
];
// context