Skip to content

Commit a30a669

Browse files
committed
feature #20273 [Serializer] Deprecate AdvancedNameConverterInterface (mdoutreluingne)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [Serializer] Deprecate ``AdvancedNameConverterInterface`` Fix #20266 Here, I don't know if I should modify or delete the `.. note::` block, what do you think? Commits ------- 2c93089 [Serializer] Deprecate ``AdvancedNameConverterInterface``
2 parents 8aa8b1e + 2c93089 commit a30a669

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

components/serializer.rst

+2-8
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,12 @@ A custom name converter can handle such cases::
549549

550550
class OrgPrefixNameConverter implements NameConverterInterface
551551
{
552-
public function normalize(string $propertyName): string
552+
public function normalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string
553553
{
554554
return 'org_'.$propertyName;
555555
}
556556

557-
public function denormalize(string $propertyName): string
557+
public function denormalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string
558558
{
559559
// removes 'org_' prefix
560560
return str_starts_with($propertyName, 'org_') ? substr($propertyName, 4) : $propertyName;
@@ -584,12 +584,6 @@ and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`::
584584
$companyCopy = $serializer->deserialize($json, Company::class, 'json');
585585
// Same data as $company
586586

587-
.. note::
588-
589-
You can also implement
590-
:class:`Symfony\\Component\\Serializer\\NameConverter\\AdvancedNameConverterInterface`
591-
to access the current class name, format and context.
592-
593587
.. _using-camelized-method-names-for-underscored-attributes:
594588

595589
CamelCase to snake_case

0 commit comments

Comments
 (0)