Skip to content

Commit 6c28fbb

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: Fixes and simplifications Improve routing debug page Improved the example to generate URLs in the console minor symfony#8704 Client's history clear alternative (takman1) [Serializer] Add new default normalizers use the ref role instead of URLs
2 parents e314923 + 456ce9f commit 6c28fbb

File tree

5 files changed

+46
-22
lines changed

5 files changed

+46
-22
lines changed

console/request_context.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ from the ``router`` service and override its settings::
7272
{
7373
protected function execute(InputInterface $input, OutputInterface $output)
7474
{
75-
$context = $this->getContainer()->get('router')->getContext();
75+
$router = $this->getContainer()->get('router');
76+
$context = $router->getContext();
7677
$context->setHost('example.com');
7778
$context->setScheme('https');
7879
$context->setBaseUrl('my/path');
7980

80-
// ... your code here
81+
$url = $router->generate('route-name', array('param-name' => 'param-value'));
82+
// ...
8183
}
8284
}

form/disabling_validation.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ for example whether an uploaded file was too large or whether non-existing
2121
fields were submitted.
2222

2323
The submission of extra form fields can be controlled with the
24-
`allow_extra_fields config option`_ and the maximum upload file size should be
25-
handled via your PHP and web server configuration.
26-
27-
.. _`allow_extra_fields config option`: https://symfony.com/doc/current/reference/forms/types/form.html#allow-extra-fields
24+
:ref:`allow_extra_fields config option <form-option-allow-extra-fields>` and
25+
the maximum upload file size should be handled via your PHP and web server
26+
configuration.

reference/forms/types/form.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Field Options
5050

5151
.. include:: /reference/forms/types/options/action.rst.inc
5252

53+
.. _form-option-allow-extra-fields:
54+
5355
allow_extra_fields
5456
~~~~~~~~~~~~~~~~~~
5557

routing/debug.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ your application:
1818

1919
.. code-block:: text
2020
21-
homepage ANY /
22-
contact GET /contact
23-
contact_process POST /contact
24-
article_show ANY /articles/{_locale}/{year}/{title}.{_format}
25-
blog ANY /blog/{page}
26-
blog_show ANY /blog/{slug}
21+
------------------ -------- -------- ------ ----------------------------------------------
22+
Name Method Scheme Host Path
23+
------------------ -------- -------- ------ ----------------------------------------------
24+
homepage ANY ANY ANY /
25+
contact GET ANY ANY /contact
26+
contact_process POST ANY ANY /contact
27+
article_show ANY ANY ANY /articles/{_locale}/{year}/{title}.{_format}
28+
blog ANY ANY ANY /blog/{page}
29+
blog_show ANY ANY ANY /blog/{slug}
30+
------------------ -------- -------- ------ ----------------------------------------------
2731
2832
You can also get very specific information on a single route by including
2933
the route name after the command:

serializer.rst

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,37 @@ you need it or it can be used in a controller::
8585
Adding Normalizers and Encoders
8686
-------------------------------
8787

88-
Once enabled, the ``serializer`` service will be available in the container
89-
and will be loaded with four :ref:`encoders <component-serializer-encoders>`
90-
(:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder`,
91-
:class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`,
92-
:class:`Symfony\\Component\\Serializer\\Encoder\\YamlEncoder`, and
93-
:class:`Symfony\\Component\\Serializer\\Encoder\\CsvEncoder`) and the
94-
:ref:`ObjectNormalizer normalizer <component-serializer-normalizers>`.
95-
96-
You can load normalizers and/or encoders by tagging them as
88+
Once enabled, the ``serializer`` service will be available in the container.
89+
It comes with a set of useful :ref:`encoders <component-serializer-encoders>`
90+
and :ref:`normalizers <component-serializer-normalizers>`.
91+
92+
Encoders supporting the following formats are enabled:
93+
94+
* JSON: :class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder`
95+
* XML: :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`
96+
97+
As well as the following normalizers:
98+
99+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer` to
100+
handle typical data objects
101+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` for
102+
objects implementing the :class:`DateTimeInterface` interface
103+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DataUriNormalizer` to
104+
transform :class:`SplFileInfo` objects in `Data URIs`_
105+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer`
106+
to deal with objects implementing the :class:`JsonSerializable` interface
107+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer` to
108+
denormalize arrays of objects using a format like `MyObject[]` (note the `[]` suffix)
109+
110+
Custom normalizers and/or encoders can also be loaded by tagging them as
97111
:ref:`serializer.normalizer <reference-dic-tags-serializer-normalizer>` and
98112
:ref:`serializer.encoder <reference-dic-tags-serializer-encoder>`. It's also
99113
possible to set the priority of the tag in order to decide the matching order.
100114

101115
Here is an example on how to load the
102-
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`:
116+
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`, a
117+
faster alternative to the `ObjectNormalizer` when data objects always use
118+
getters and setters:
103119

104120
.. configuration-block::
105121

@@ -310,3 +326,4 @@ take a look at how this bundle works.
310326
.. _`ApiPlatform`: https://github.com/api-platform/core
311327
.. _`JSON-LD`: http://json-ld.org
312328
.. _`Hydra Core Vocabulary`: http://hydra-cg.com
329+
.. _`Data URIs`: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs

0 commit comments

Comments
 (0)