Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e4c705b

Browse files
committed
[Serializer] Use NormalizerInterface instead of ObjectNormalizer
1 parent 66a8003 commit e4c705b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

serializer/custom_normalizer.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,20 @@ Creating a New Normalizer
1212
Imagine you want add, modify, or remove some properties during the serialization
1313
process. For that you'll have to create your own normalizer. But it's usually
1414
preferable to let Symfony normalize the object, then hook into the normalization
15-
to customize the normalized data. To do that, leverage the ``ObjectNormalizer``::
15+
to customize the normalized data.::
1616

1717
// src/Serializer/TopicNormalizer.php
1818
namespace App\Serializer;
1919

2020
use App\Entity\Topic;
2121
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2222
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
23-
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
2423

2524
class TopicNormalizer implements NormalizerInterface
2625
{
2726
public function __construct(
2827
private UrlGeneratorInterface $router,
29-
private ObjectNormalizer $normalizer,
28+
private NormalizerInterface $normalizer,
3029
) {
3130
}
3231

0 commit comments

Comments
 (0)