Skip to content

Commit 2063d26

Browse files
committed
Merge branch '4.4'
* 4.4: Remove chrome debug since it's no longer present Fix several typos [#11635] Fixed syntax 11627 Minor/Patch version fix edit normalizer deprecated method on 4.2
2 parents 2209f3b + 657d2b6 commit 2063d26

File tree

3 files changed

+46
-15
lines changed

3 files changed

+46
-15
lines changed

components/serializer.rst

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ When serializing, you can set a callback to format a specific object property::
638638
$encoder = new JsonEncoder();
639639

640640
// all callback parameters are optional (you can omit the ones you don't use)
641-
$callback = function ($innerObject, $outerObject, string $attributeName, string $format = null, array $context = []) {
641+
$dateCallback = function ($innerObject, $outerObject, string $attributeName, string $format = null, array $context = []) {
642642
return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ISO8601) : '';
643643
};
644644

@@ -660,6 +660,11 @@ When serializing, you can set a callback to format a specific object property::
660660
$serializer->serialize($person, 'json');
661661
// Output: {"name":"cordoval", "age": 34, "createdAt": "2014-03-22T09:43:12-0500"}
662662

663+
.. deprecated:: 4.2
664+
665+
The :method:`Symfony\\Component\\Serializer\\Normalizer\\AbstractNormalizer::setCallbacks` is deprecated since
666+
Symfony 4.2, use the "callbacks" key of the context instead.
667+
663668
.. _component-serializer-normalizers:
664669

665670
Normalizers
@@ -926,9 +931,9 @@ when such a case is encountered::
926931

927932
echo $serializer->serialize($organization, 'json'); // Throws a CircularReferenceException
928933

929-
The ``setCircularReferenceLimit()`` method of this normalizer sets the number
930-
of times it will serialize the same object before considering it a circular
931-
reference. Its default value is ``1``.
934+
The key ``circular_reference_limit`` in the default context sets the number of
935+
times it will serialize the same object before considering it a circular
936+
reference. The default value is ``1``.
932937

933938
Instead of throwing an exception, circular references can also be handled
934939
by custom callables. This is especially useful when serializing entities
@@ -946,6 +951,12 @@ having unique identifiers::
946951
var_dump($serializer->serialize($org, 'json'));
947952
// {"name":"Les-Tilleuls.coop","members":[{"name":"K\u00e9vin", organization: "Les-Tilleuls.coop"}]}
948953

954+
.. deprecated:: 4.2
955+
956+
The :method:`Symfony\\Component\\Serializer\\Normalizer\\AbstractNormalizer::setCircularReferenceHandler`
957+
method is deprecated since Symfony 4.2. Use the ``circular_reference_handler``
958+
key of the context instead.
959+
949960
Handling Serialization Depth
950961
----------------------------
951962

@@ -1073,11 +1084,16 @@ having unique identifiers::
10731084
$level2->child = $level3;
10741085

10751086
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
1076-
$normalizer = new ObjectNormalizer($classMetadataFactory);
1087+
10771088
// all callback parameters are optional (you can omit the ones you don't use)
1078-
$normalizer->setMaxDepthHandler(function ($innerObject, $outerObject, string $attributeName, string $format = null, array $context = []) {
1089+
$maxDepthHandler = function ($innerObject, $outerObject, string $attributeName, string $format = null, array $context = []) {
10791090
return '/foos/'.$innerObject->id;
1080-
});
1091+
};
1092+
1093+
$defaultContext = [
1094+
AbstractObjectNormalizer::MAX_DEPTH_HANDLER => $maxDepthHandler,
1095+
];
1096+
$normalizer = new ObjectNormalizer($classMetadataFactory, null, null, null, null, null, $defaultContext);
10811097

10821098
$serializer = new Serializer([$normalizer]);
10831099

@@ -1092,6 +1108,12 @@ having unique identifiers::
10921108
];
10931109
*/
10941110

1111+
.. deprecated:: 4.2
1112+
1113+
The :method:`Symfony\\Component\\Serializer\\Normalizer\\AbstractNormalizer::setMaxDepthHandler`
1114+
method is deprecated since Symfony 4.2. Use the ``max_depth_handler``
1115+
key of the context instead.
1116+
10951117
Handling Arrays
10961118
---------------
10971119

setup/upgrade_minor.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ There are two steps to upgrading a minor version:
2121
1) Update the Symfony Library via Composer
2222
------------------------------------------
2323

24-
Your ``composer.json`` file should already be configured to allow your Symfony
25-
packages to be upgraded to minor versions. But, if a package was not upgraded,
26-
check that the version constrains of your Symfony dependencies are like this:
24+
The ``composer.json`` file is configured to allow Symfony packages to be
25+
upgraded to patch versions. But, if you would like the packages to be upgraded
26+
to minor versions, check that the version constrains of the Symfony dependencies
27+
are like this:
2728

2829
.. code-block:: json
2930
@@ -42,6 +43,19 @@ check that the version constrains of your Symfony dependencies are like this:
4243
"...": "...",
4344
}
4445
46+
At the bottom of your ``composer.json`` file, in the ``extra`` block you can
47+
find a data setting for the symfony version. Make sure to also upgrade
48+
this one. For instance, update it to ``4.3.*`` to upgrade to Symfony 4.3:
49+
50+
.. code-block:: json
51+
52+
"extra": {
53+
"symfony": {
54+
"allow-contrib": false,
55+
"require": "4.3.*"
56+
}
57+
}
58+
4559
Next, use Composer to download new versions of the libraries:
4660

4761
.. code-block:: terminal

web_link.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ the priority of the resource to download using the ``importance`` attribute:
7979
<link rel="stylesheet" href="{{ preload('/app.css', { as: 'style', importance: 'low' }) }}">
8080
</head>
8181

82-
.. tip::
83-
84-
Google Chrome provides an interface to debug HTTP/2 connections. Browse
85-
``chrome://net-internals/#http2`` to see all the details.
86-
8782
How does it work?
8883
~~~~~~~~~~~~~~~~~
8984

0 commit comments

Comments
 (0)