mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-29 05:26:13 +00:00
AccompanyingPeriodWorkEvaluation: fix circular reference when serialising
This commit is contained in:
parent
ee8f331de4
commit
44e93dd5f8
@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Serializer\Normalizer;
|
|||||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
||||||
use Chill\MainBundle\Workflow\Helper\MetadataExtractor;
|
use Chill\MainBundle\Workflow\Helper\MetadataExtractor;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||||
@ -46,7 +47,10 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz
|
|||||||
{
|
{
|
||||||
$initial = $this->normalizer->normalize($object, $format, array_merge(
|
$initial = $this->normalizer->normalize($object, $format, array_merge(
|
||||||
$context,
|
$context,
|
||||||
[self::IGNORE_EVALUATION => spl_object_hash($object)]
|
[self::IGNORE_EVALUATION => spl_object_hash($object)],
|
||||||
|
[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => static function ($object, $format, $context) {
|
||||||
|
return $object->getId();
|
||||||
|
}]
|
||||||
));
|
));
|
||||||
|
|
||||||
// due to bug: https://api-platform.com/docs/core/serialization/#collection-relation
|
// due to bug: https://api-platform.com/docs/core/serialization/#collection-relation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user