mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'issue378_normalize_requestor' into 'master'
accompanying course: normalize the requestor entity See merge request Chill-Projet/chill-bundles!329
This commit is contained in:
commit
58c8373c81
@ -11,6 +11,7 @@ and this project adheres to
|
||||
## Unreleased
|
||||
|
||||
<!-- write down unreleased development here -->
|
||||
* fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378)
|
||||
* [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427)
|
||||
* [person] accompanying course work: fix on-the-fly update of thirdParty
|
||||
* [on-the-fly] close modal only after validation
|
||||
@ -37,7 +38,7 @@ and this project adheres to
|
||||
* [parcours]: validation + message for closing parcours adjusted.
|
||||
* [household]: household composition double edit button replaced by a delete action (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/426)
|
||||
[fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
||||
[homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||
[homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||
* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421)
|
||||
* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424)
|
||||
* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429)
|
||||
@ -45,7 +46,7 @@ and this project adheres to
|
||||
* [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal
|
||||
* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend
|
||||
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
||||
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||
|
||||
### test release 2021-01-31
|
||||
|
||||
@ -94,7 +95,7 @@ and this project adheres to
|
||||
* [popover] add popover html popup mechanism (used by workflow breadcrumb)
|
||||
* [templates] improve updatedBy macro in item metadatas
|
||||
* [parcours]: bug fix when comment is pinned all other comments remain in the collection (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/385)
|
||||
* [workflow]
|
||||
* [workflow]
|
||||
* add My workflow section with my opened subscriptions
|
||||
* apply workflow on documents, accompanyingCourseWork and Evaluations
|
||||
* [wopi-link] a new vue component allow to open wopi link in a fullscreen chill-themed modal
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||
|
||||
use LogicException;
|
||||
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
|
||||
use Symfony\Component\Serializer\Exception\RuntimeException;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
@ -44,7 +45,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
|
||||
if ($this->denormalizer->supportsDenormalization($data, $localType, $format)) {
|
||||
try {
|
||||
return $this->denormalizer->denormalize($data, $localType, $format, $context);
|
||||
} catch (RuntimeException $e) {
|
||||
} catch (RuntimeException|NotNormalizableValueException $e) {
|
||||
$lastException = $e;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Chill\MainBundle\Serializer\Model\Counter;
|
||||
use Chill\MainBundle\Serializer\Normalizer\DiscriminatedObjectDenormalizer;
|
||||
use Chill\PersonBundle\AccompanyingPeriod\Suggestion\ReferralsSuggestionInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
@ -234,17 +235,19 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
$requestor = null;
|
||||
$exceptions = [];
|
||||
|
||||
foreach ([Person::class, ThirdParty::class] as $class) {
|
||||
try {
|
||||
$requestor = $this->getSerializer()
|
||||
->deserialize($request->getContent(), $class, $_format, []);
|
||||
} catch (RuntimeException $e) {
|
||||
$exceptions[] = $e;
|
||||
}
|
||||
try {
|
||||
$requestor = $this->getSerializer()->deserialize(
|
||||
$request->getContent(),
|
||||
'@multi',
|
||||
$_format,
|
||||
[DiscriminatedObjectDenormalizer::ALLOWED_TYPES => [Person::class, ThirdParty::class]]
|
||||
);
|
||||
} catch (RuntimeException $e) {
|
||||
$exceptions[] = $e;
|
||||
}
|
||||
|
||||
if (null === $requestor) {
|
||||
throw new BadRequestException('Could not find any person or requestor', 0, $exceptions[0]);
|
||||
throw new BadRequestException('Could not find any person or thirdparty', 0, null);
|
||||
}
|
||||
|
||||
$accompanyingPeriod->setRequestor($requestor);
|
||||
|
Loading…
x
Reference in New Issue
Block a user