Skip to content

Commit fce8eb0

Browse files
Update serialization.md (#1950)
* Update serialization.md the ContextAwareDenormalizerInterface is removed, use DenormalizerInterface instead for your denormalizer * Remove the old denormalizer that used the deprecated `ContextAwareDenormalizerInterface`
1 parent 1427636 commit fce8eb0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

core/serialization.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,11 @@ namespace App\Serializer;
579579
use ApiPlatform\Api\IriConverterInterface;
580580
use App\Entity\Dummy;
581581
use App\Entity\RelatedDummy;
582-
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
582+
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
583583
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
584584
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
585585
586-
class PlainIdentifierDenormalizer implements ContextAwareDenormalizerInterface, DenormalizerAwareInterface
586+
class PlainIdentifierDenormalizer implements DenormalizerInterface, DenormalizerAwareInterface
587587
{
588588
use DenormalizerAwareTrait;
589589
@@ -605,6 +605,15 @@ class PlainIdentifierDenormalizer implements ContextAwareDenormalizerInterface,
605605
{
606606
return \in_array($format, ['json', 'jsonld'], true) && is_a($type, Dummy::class, true) && !empty($data['relatedDummy']) && !isset($context[__CLASS__]);
607607
}
608+
609+
public function getSupportedTypes(?string $format): array
610+
{
611+
return [
612+
'object' => null,
613+
'*' => false,
614+
Dummy::class => true
615+
];
616+
}
608617
}
609618
```
610619

0 commit comments

Comments
 (0)