mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
fix normalisation of AccompanyingCourse requestor api
This commit is contained in:
@@ -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;
|
||||
@@ -235,13 +236,12 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
$exceptions = [];
|
||||
|
||||
try {
|
||||
$contentAsArray = json_decode($request->getContent(), true);
|
||||
$entityType = $contentAsArray['type'];
|
||||
if ($entityType === 'person') {
|
||||
$requestor = $this->getSerializer()->deserialize($request->getContent(), Person::class, $_format, []);
|
||||
} elseif ($entityType === 'thirdparty') {
|
||||
$requestor = $this->getSerializer()->deserialize($request->getContent(), ThirdParty::class, $_format, []);
|
||||
}
|
||||
$requestor = $this->getSerializer()->deserialize(
|
||||
$request->getContent(),
|
||||
'@multi',
|
||||
$_format,
|
||||
[DiscriminatedObjectDenormalizer::ALLOWED_TYPES => [Person::class, ThirdParty::class]]
|
||||
);
|
||||
} catch (RuntimeException $e) {
|
||||
$exceptions[] = $e;
|
||||
}
|
||||
|
Reference in New Issue
Block a user