mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
allow to edit civility in onTheFly
This commit is contained in:
@@ -14,7 +14,6 @@ namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Civility;
|
||||
use Chill\MainBundle\Phonenumber\PhoneNumberHelperInterface;
|
||||
use Chill\MainBundle\Repository\CivilityRepository;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
@@ -50,8 +49,6 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
||||
|
||||
private CenterResolverManagerInterface $centerResolverManager;
|
||||
|
||||
private CivilityRepository $civilityRepository;
|
||||
|
||||
private PhoneNumberHelperInterface $phoneNumberHelper;
|
||||
|
||||
private ChillEntityRenderExtension $render;
|
||||
@@ -65,14 +62,12 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
||||
PersonRepository $repository,
|
||||
CenterResolverManagerInterface $centerResolverManager,
|
||||
ResidentialAddressRepository $residentialAddressRepository,
|
||||
CivilityRepository $civilityRepository,
|
||||
PhoneNumberHelperInterface $phoneNumberHelper /* TODO maybe not necessayr any more */
|
||||
) {
|
||||
$this->render = $render;
|
||||
$this->repository = $repository;
|
||||
$this->centerResolverManager = $centerResolverManager;
|
||||
$this->residentialAddressRepository = $residentialAddressRepository;
|
||||
$this->civilityRepository = $civilityRepository;
|
||||
$this->phoneNumberHelper = $phoneNumberHelper;
|
||||
}
|
||||
|
||||
@@ -186,8 +181,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
||||
break;
|
||||
|
||||
case 'civility':
|
||||
//$civility = $this->denormalizer->denormalize($data[$item], Civility::class, $format, $context); // this seems the right way to do it, but this does not render a Civility object.
|
||||
$civility = $this->civilityRepository->findOneBy(['id' => $data[$item]['id']]);
|
||||
$civility = $this->denormalizer->denormalize($data[$item], Civility::class, $format, []);
|
||||
|
||||
$person->setCivility($civility);
|
||||
|
||||
@@ -227,6 +221,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
||||
'mobilenumber' => $this->normalizer->normalize($person->getMobilenumber(), $format, $context),
|
||||
'email' => $person->getEmail(),
|
||||
'gender' => $person->getGender(),
|
||||
'civility' => $this->normalizer->normalize($person->getCivility(), $format, $context),
|
||||
];
|
||||
|
||||
if (in_array('minimal', $groups, true) && 1 === count($groups)) {
|
||||
|
Reference in New Issue
Block a user