Skip to content

Commit 604e4b7

Browse files
committed
Merge branch '3.4' into 4.0
* 3.4: Fixed a typo Fixes and simplifications Improve routing debug page Improved the example to generate URLs in the console Minor typo minor symfony#8704 Client's history clear alternative (takman1) [Serializer] Add new default normalizers use the ref role instead of URLs Update timezone.rst Update timezone.rst
2 parents 0dc8945 + 6c28fbb commit 604e4b7

File tree

6 files changed

+68
-21
lines changed

6 files changed

+68
-21
lines changed

console/request_context.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ router service and override its settings::
8585
$context->setScheme('https');
8686
$context->setBaseUrl('my/path');
8787

88-
// ... your code here
88+
$url = $this->router->generate('route-name', array('param-name' => 'param-value'));
89+
// ...
8990
}
9091
}

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

reference/forms/types/timezone.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ manually, but then you should just use the ``ChoiceType`` directly.
1717
+-------------+------------------------------------------------------------------------+
1818
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
1919
+-------------+------------------------------------------------------------------------+
20+
| Options | - `input`_ |
21+
| | - `regions`_ |
22+
+-------------+------------------------------------------------------------------------+
2023
| Overridden | - `choices`_ |
2124
| options | |
2225
+-------------+------------------------------------------------------------------------+
@@ -45,6 +48,27 @@ manually, but then you should just use the ``ChoiceType`` directly.
4548
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType` |
4649
+-------------+------------------------------------------------------------------------+
4750

51+
Field Options
52+
-------------
53+
54+
input
55+
~~~~~
56+
57+
**type**: ``string`` **default**: ``string``
58+
59+
The format of the *input* data - i.e. the format that the timezone is stored
60+
on your underlying object. Valid values are:
61+
62+
* ``string`` (e.g. ``America/New_York``)
63+
* ``datetimezone`` (a ``DateTimeZone`` object)
64+
65+
regions
66+
~~~~~~~
67+
68+
**type**: ``int`` **default**: ``\DateTimeZone::ALL``
69+
70+
The available regions in the timezone choice list. For example: ``DateTimeZone::AMERICA | DateTimeZone::EUROPE``
71+
4872
Overridden Options
4973
------------------
5074

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
@@ -44,21 +44,37 @@ you need it or it can be used in a controller::
4444
Adding Normalizers and Encoders
4545
-------------------------------
4646

47-
Once enabled, the serializer service will be available in the container
48-
and will be loaded with four :ref:`encoders <component-serializer-encoders>`
49-
(:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder`,
50-
:class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`,
51-
:class:`Symfony\\Component\\Serializer\\Encoder\\YamlEncoder`, and
52-
:class:`Symfony\\Component\\Serializer\\Encoder\\CsvEncoder`) and the
53-
:ref:`ObjectNormalizer normalizer <component-serializer-normalizers>`.
54-
55-
You can load normalizers and/or encoders by tagging them as
47+
Once enabled, the ``serializer`` service will be available in the container.
48+
It comes with a set of useful :ref:`encoders <component-serializer-encoders>`
49+
and :ref:`normalizers <component-serializer-normalizers>`.
50+
51+
Encoders supporting the following formats are enabled:
52+
53+
* JSON: :class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder`
54+
* XML: :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`
55+
56+
As well as the following normalizers:
57+
58+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer` to
59+
handle typical data objects
60+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` for
61+
objects implementing the :class:`DateTimeInterface` interface
62+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DataUriNormalizer` to
63+
transform :class:`SplFileInfo` objects in `Data URIs`_
64+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer`
65+
to deal with objects implementing the :class:`JsonSerializable` interface
66+
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer` to
67+
denormalize arrays of objects using a format like `MyObject[]` (note the `[]` suffix)
68+
69+
Custom normalizers and/or encoders can also be loaded by tagging them as
5670
:ref:`serializer.normalizer <reference-dic-tags-serializer-normalizer>` and
5771
:ref:`serializer.encoder <reference-dic-tags-serializer-encoder>`. It's also
5872
possible to set the priority of the tag in order to decide the matching order.
5973

6074
Here is an example on how to load the
61-
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`:
75+
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`, a
76+
faster alternative to the `ObjectNormalizer` when data objects always use
77+
getters and setters:
6278

6379
.. configuration-block::
6480

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

0 commit comments

Comments
 (0)