From 22a87b5fa09f2dc1aea13e77710271e2fe0715a1 Mon Sep 17 00:00:00 2001 From: Peter Rehm Date: Mon, 20 Oct 2014 22:40:29 +0200 Subject: [PATCH 01/15] Added depreciation note for the cascade_validation constraint and updated position of depreciation notes --- reference/forms/types/form.rst | 2 +- .../forms/types/options/cascade_validation.rst.inc | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 2ccb0debf17..eda6104fc6d 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -11,7 +11,7 @@ on all types for which ``form`` is the parent type. | Options | - `action`_ | | | - `allow_extra_fields`_ | | | - `by_reference`_ | -| | - `cascade_validation`_ | +| | - `cascade_validation`_ (deprecated as of 2.8) | | | - `compound`_ | | | - `constraints`_ | | | - `data`_ | diff --git a/reference/forms/types/options/cascade_validation.rst.inc b/reference/forms/types/options/cascade_validation.rst.inc index de75044ba73..2136111fc80 100644 --- a/reference/forms/types/options/cascade_validation.rst.inc +++ b/reference/forms/types/options/cascade_validation.rst.inc @@ -1,6 +1,12 @@ cascade_validation ~~~~~~~~~~~~~~~~~~ +.. caution:: + + The ``cascade_validation`` option has been deprecated in Symfony 2.8 and will be removed + in 3.0. Instead, use the ``Valid`` constraint in your model to cascade validation. Be aware + of the fact that the ``validation_group`` option will not be considered for child forms. + **type**: ``boolean`` **default**: ``false`` Set this option to ``true`` to force validation on embedded form types. @@ -10,11 +16,10 @@ the data from ``CategoryType`` to also be validated. .. tip:: - Instead of using this option, it is recommended that you use the ``Valid`` + Instead of using this option, it is recommended that you use the :doc:`Valid ` constraint in your model to force validation on a child object stored on a property. This cascades only the validation but not the use of - the ``validation_groups`` option on child forms. You can read more - about this in the section about - :ref:`Embedding a Single Object `. + the :ref:`validation_groups ` option on child forms. You can read more + about this in the section about :ref:`Embedding a Single Object `. .. include:: /reference/forms/types/options/_error_bubbling_hint.rst.inc From 485c8a0f9eefaa14c48a6799845816fad32f2d1e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 16 Jun 2015 21:12:46 +0200 Subject: [PATCH 02/15] document new Doctrine APC cache service --- reference/configuration/framework.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 71e8aac1a18..7885c10b7e2 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1372,6 +1372,13 @@ cache The service that is used to persist class metadata in a cache. The service has to implement the :class:`Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface`. +.. versionadded:: 2.8 + The ``validator.mapping.cache.doctrine.apc`` service was introduced in + Symfony 2.8. + +Set this option to ``validator.mapping.cache.doctrine.apc`` to use the APC +cache provide from the Doctrine project. + enable_annotations .................. From c9e86341a6c35ad343bd540fba96248c70084f47 Mon Sep 17 00:00:00 2001 From: Yannick Date: Fri, 26 Jun 2015 17:36:24 -0400 Subject: [PATCH 03/15] [#3782] Deprecating the read_only option (committed by weaverryan, original credit to the author on this commit) --- reference/forms/twig_reference.rst | 2 -- reference/forms/types/birthday.rst | 2 +- reference/forms/types/checkbox.rst | 2 +- reference/forms/types/choice.rst | 2 +- reference/forms/types/country.rst | 2 +- reference/forms/types/currency.rst | 2 +- reference/forms/types/date.rst | 2 +- reference/forms/types/datetime.rst | 2 +- reference/forms/types/email.rst | 2 +- reference/forms/types/entity.rst | 2 +- reference/forms/types/file.rst | 2 +- reference/forms/types/form.rst | 2 +- reference/forms/types/integer.rst | 2 +- reference/forms/types/language.rst | 2 +- reference/forms/types/locale.rst | 2 +- reference/forms/types/money.rst | 2 +- reference/forms/types/number.rst | 2 +- reference/forms/types/options/read_only.rst.inc | 5 +++++ reference/forms/types/password.rst | 2 +- reference/forms/types/percent.rst | 2 +- reference/forms/types/radio.rst | 2 +- reference/forms/types/search.rst | 2 +- reference/forms/types/text.rst | 2 +- reference/forms/types/textarea.rst | 2 +- reference/forms/types/time.rst | 2 +- reference/forms/types/timezone.rst | 2 +- reference/forms/types/url.rst | 2 +- 27 files changed, 30 insertions(+), 27 deletions(-) diff --git a/reference/forms/twig_reference.rst b/reference/forms/twig_reference.rst index 68e694f1390..5ee8243c908 100644 --- a/reference/forms/twig_reference.rst +++ b/reference/forms/twig_reference.rst @@ -340,8 +340,6 @@ object: +------------------------+-------------------------------------------------------------------------------------+ | ``value`` | The value that will be used when rendering (commonly the ``value`` HTML attribute). | +------------------------+-------------------------------------------------------------------------------------+ -| ``read_only`` | If ``true``, ``readonly="readonly"`` is added to the field. | -+------------------------+-------------------------------------------------------------------------------------+ | ``disabled`` | If ``true``, ``disabled="disabled"`` is added to the field. | +------------------------+-------------------------------------------------------------------------------------+ | ``required`` | If ``true``, a ``required`` attribute is added to the field to activate HTML5 | diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index 380d99a3747..740c885efba 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -41,7 +41,7 @@ option defaults to 120 years ago to the current year. | | - `invalid_message`_ | | | - `invalid_message_parameters`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | +----------------------+-------------------------------------------------------------------------------+ | Parent type | :doc:`date ` | +----------------------+-------------------------------------------------------------------------------+ diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst index abef5a25330..3e04856ac4a 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -23,7 +23,7 @@ if the box is unchecked, the value will be set to false. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+------------------------------------------------------------------------+ | Parent type | :doc:`form ` | diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index bb2bd05fddc..c917f6d1189 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -32,7 +32,7 @@ option. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+------------------------------------------------------------------------------+ | Parent type | :doc:`form ` | diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst index fd9840d59d7..c33e67d3d35 100644 --- a/reference/forms/types/country.rst +++ b/reference/forms/types/country.rst @@ -42,7 +42,7 @@ you should just use the ``choice`` type directly. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+-----------------------------------------------------------------------+ | Parent type | :doc:`choice ` | diff --git a/reference/forms/types/currency.rst b/reference/forms/types/currency.rst index 43cc0deb7bc..1d8bbd2d126 100644 --- a/reference/forms/types/currency.rst +++ b/reference/forms/types/currency.rst @@ -35,7 +35,7 @@ you should just use the ``choice`` type directly. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+------------------------------------------------------------------------+ | Parent type | :doc:`choice ` | diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 0d97757d5d9..b673477950c 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -40,7 +40,7 @@ day and year) or three select boxes (see the `widget`_ option). | | - `invalid_message`_ | | | - `invalid_message_parameters`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | +----------------------+-----------------------------------------------------------------------------+ | Parent type | :doc:`form ` | +----------------------+-----------------------------------------------------------------------------+ diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index c4a04e0082d..b50c7ec12a7 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -40,7 +40,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array. | | - `invalid_message`_ | | | - `invalid_message_parameters`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | +----------------------+-----------------------------------------------------------------------------+ | Parent type | :doc:`form ` | +----------------------+-----------------------------------------------------------------------------+ diff --git a/reference/forms/types/email.rst b/reference/forms/types/email.rst index 0d6f548a033..58b68da5cc8 100644 --- a/reference/forms/types/email.rst +++ b/reference/forms/types/email.rst @@ -19,7 +19,7 @@ The ``email`` field is a text field that is rendered using the HTML5 | | - `label_attr`_ | | | - `mapped`_ | | | - `max_length`_ (deprecated as of 2.5) | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | | | - `trim`_ | +-------------+---------------------------------------------------------------------+ diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 43ab2af8915..b2a9dc6ebf8 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -39,7 +39,7 @@ objects from the database. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+------------------------------------------------------------------+ | Parent type | :doc:`choice ` | diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst index 4bfbadf064a..1205af33096 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -18,7 +18,7 @@ The ``file`` type represents a file input in your form. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+---------------------------------------------------------------------+ | Parent type | :doc:`form ` | diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index eda6104fc6d..b5409100f4b 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -30,7 +30,7 @@ on all types for which ``form`` is the parent type. | | - `pattern`_ (deprecated as of 2.5) | | | - `post_max_size_message`_ | | | - `property_path`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | | | - `trim`_ | +-----------+--------------------------------------------------------------------+ diff --git a/reference/forms/types/integer.rst b/reference/forms/types/integer.rst index 4e9e0df2b62..6425c1daf7f 100644 --- a/reference/forms/types/integer.rst +++ b/reference/forms/types/integer.rst @@ -30,7 +30,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+-----------------------------------------------------------------------+ | Parent type | :doc:`form ` | diff --git a/reference/forms/types/language.rst b/reference/forms/types/language.rst index c9e4ddd08a3..e4efe7bf58c 100644 --- a/reference/forms/types/language.rst +++ b/reference/forms/types/language.rst @@ -43,7 +43,7 @@ you should just use the ``choice`` type directly. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+------------------------------------------------------------------------+ | Parent type | :doc:`choice ` | diff --git a/reference/forms/types/locale.rst b/reference/forms/types/locale.rst index 5e887150262..e822ffd3c18 100644 --- a/reference/forms/types/locale.rst +++ b/reference/forms/types/locale.rst @@ -45,7 +45,7 @@ you should just use the ``choice`` type directly. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+------------------------------------------------------------------------+ | Parent type | :doc:`choice ` | diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index a3b707b8931..1a2a856fcc5 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -29,7 +29,7 @@ how the input and output of the data is handled. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+---------------------------------------------------------------------+ | Parent type | :doc:`form ` | diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index 5bc6d3f052a..5881283a376 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -25,7 +25,7 @@ that you want to use for your number. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+----------------------------------------------------------------------+ | Parent type | :doc:`form ` | diff --git a/reference/forms/types/options/read_only.rst.inc b/reference/forms/types/options/read_only.rst.inc index 7988f0378c8..d19de30612b 100644 --- a/reference/forms/types/options/read_only.rst.inc +++ b/reference/forms/types/options/read_only.rst.inc @@ -1,6 +1,11 @@ read_only ~~~~~~~~~ +.. caution:: + + The ``read_only`` option has been deprecated and will be removed in 3.0. + Instead, use the ``attr`` option by setting it to an array with a ``readonly`` key. + **type**: ``boolean`` **default**: ``false`` If this option is true, the field will be rendered with the ``readonly`` diff --git a/reference/forms/types/password.rst b/reference/forms/types/password.rst index 3ce6256b382..57fac574bd9 100644 --- a/reference/forms/types/password.rst +++ b/reference/forms/types/password.rst @@ -19,7 +19,7 @@ The ``password`` field renders an input password text box. | | - `label_attr`_ | | | - `mapped`_ | | | - `max_length`_ (deprecated as of 2.5) | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | | | - `trim`_ | +-------------+------------------------------------------------------------------------+ diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst index 10cca29531d..1bbce340b04 100644 --- a/reference/forms/types/percent.rst +++ b/reference/forms/types/percent.rst @@ -28,7 +28,7 @@ This field adds a percentage sign "``%``" after the input box. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+-----------------------------------------------------------------------+ | Parent type | :doc:`form ` | diff --git a/reference/forms/types/radio.rst b/reference/forms/types/radio.rst index 771f5b13490..b1adec4c6ea 100644 --- a/reference/forms/types/radio.rst +++ b/reference/forms/types/radio.rst @@ -30,7 +30,7 @@ If you want to have a boolean field, use :doc:`checkbox ` | diff --git a/reference/forms/types/search.rst b/reference/forms/types/search.rst index b491b689f90..69f4f449734 100644 --- a/reference/forms/types/search.rst +++ b/reference/forms/types/search.rst @@ -20,7 +20,7 @@ Read about the input search field at `DiveIntoHTML5.info`_ | | - `label_attr`_ | | | - `mapped`_ | | | - `max_length`_ (deprecated as of 2.5) | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | | | - `trim`_ | +-------------+----------------------------------------------------------------------+ diff --git a/reference/forms/types/text.rst b/reference/forms/types/text.rst index 2aa14cb7a55..d45204ed9b5 100644 --- a/reference/forms/types/text.rst +++ b/reference/forms/types/text.rst @@ -18,7 +18,7 @@ The text field represents the most basic input text field. | | - `label_attr`_ | | | - `mapped`_ | | | - `max_length`_ (deprecated as of 2.5) | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | | | - `trim`_ | +-------------+--------------------------------------------------------------------+ diff --git a/reference/forms/types/textarea.rst b/reference/forms/types/textarea.rst index 473c69c9d5c..18ce38f4a4b 100644 --- a/reference/forms/types/textarea.rst +++ b/reference/forms/types/textarea.rst @@ -19,7 +19,7 @@ Renders a ``textarea`` HTML element. | | - `label_attr`_ | | | - `mapped`_ | | | - `max_length`_ (deprecated as of 2.5) | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | | | - `trim`_ | +-------------+------------------------------------------------------------------------+ diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index 97c291e061b..4b976a02b0d 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -37,7 +37,7 @@ stored as a ``DateTime`` object, a string, a timestamp or an array. | | - `invalid_message`_ | | | - `invalid_message_parameters`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | +----------------------+-----------------------------------------------------------------------------+ | Parent type | form | +----------------------+-----------------------------------------------------------------------------+ diff --git a/reference/forms/types/timezone.rst b/reference/forms/types/timezone.rst index 73537fc1619..9fe22b11b18 100644 --- a/reference/forms/types/timezone.rst +++ b/reference/forms/types/timezone.rst @@ -38,7 +38,7 @@ you should just use the ``choice`` type directly. | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | +-------------+------------------------------------------------------------------------+ | Parent type | :doc:`choice ` | diff --git a/reference/forms/types/url.rst b/reference/forms/types/url.rst index d4903174d3f..ff4656dd6ed 100644 --- a/reference/forms/types/url.rst +++ b/reference/forms/types/url.rst @@ -22,7 +22,7 @@ have a protocol. | | - `label_attr`_ | | | - `mapped`_ | | | - `max_length`_ (deprecated as of 2.5) | -| | - `read_only`_ | +| | - `read_only`_ (deprecated as of 2.8) | | | - `required`_ | | | - `trim`_ | +-------------+-------------------------------------------------------------------+ From dd0e33f683e04227483b44be2f4416f635db584c Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 26 Jun 2015 17:49:44 -0400 Subject: [PATCH 04/15] minor #3782 [Form] Deprecate read_only option (snoob) From 9718c14b4c6bb9e9a1a6e670f84a87286ce0696d Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Thu, 4 Jun 2015 01:30:28 +0200 Subject: [PATCH 05/15] [Serializer] Array Denormalization --- components/serializer.rst | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/components/serializer.rst b/components/serializer.rst index eca1925cb0a..a6887fb3132 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -573,6 +573,55 @@ having unique identifiers:: echo $serializer->serialize($org, 'json'); // {"name":"Les-Tilleuls.coop","members":[{"name":"K\u00e9vin", organization: "Les-Tilleuls.coop"}]} +Handling Arrays +--------------- + +The Serializer component is capable of handling arrays of objects as well. +Serializing arrays works just like serializing a single object:: + + use Acme\Person; + + $person1 = new Person(); + $person1->setName('foo'); + $person1->setAge(99); + $person1->setSportsman(false); + + $person2 = new Person(); + $person2->setName('bar'); + $person2->setAge(33); + $person2->setSportsman(true); + + $persons = array($person1, $person2); + $data = $serializer->serialize($persons, 'json'); + + // $data contains [{"name":"foo","age":99,"sportsman":false},{"name":"bar","age":33,"sportsman":true}] + +.. versionadded:: 2.8 + The :class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer` + class was introduced in 2.8. Prior to Symfony 2.8, only the serialization of + arrays is supported. + +If you want to deserialize such a structure, you need to add the +:class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer` +to the set of normalizers. By appending ``[]`` to the type parameter of the +:method:`Symfony\\Component\\Serializer\\Serializer::deserialize` method, +you indicate that you're expecting an array instead of a single object. + +.. code-block:: php + + use Symfony\Component\Serializer\Encoder\JsonEncoder; + use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer; + use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer; + use Symfony\Component\Serializer\Serializer; + + $serializer = new Serializer( + array(new GetSetMethodNormalizer(), new ArrayDenormalizer()), + array(new JsonEncoder()) + ); + + $data = ...; // The serialized data from the previous example + $persons = $serializer->deserialize($data, 'Acme\Person[]', 'json'); + .. seealso:: A popular alternative to the Symfony Serializer Component is the third-party From d4d1f122f674bb1094b227fafe14b8a0a7de9005 Mon Sep 17 00:00:00 2001 From: Hari KT Date: Sun, 28 Jun 2015 13:30:49 +0530 Subject: [PATCH 06/15] Starting with range documentation --- reference/forms/types/range.rst | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 reference/forms/types/range.rst diff --git a/reference/forms/types/range.rst b/reference/forms/types/range.rst new file mode 100644 index 00000000000..8be30c3f639 --- /dev/null +++ b/reference/forms/types/range.rst @@ -0,0 +1,56 @@ +.. index:: + single: Forms; Fields; range + +range Field Type +================ + +The ``range`` field is a slider that is rendered using the HTML5 +```` tag. + ++-------------+---------------------------------------------------------------------+ +| Rendered as | ``input`` ``range`` field (slider in html5 supported browser) | ++-------------+---------------------------------------------------------------------+ +| Inherited | - `data`_ | +| options | - `disabled`_ | +| | - `empty_data`_ | +| | - `error_bubbling`_ | +| | - `error_mapping`_ | +| | - `label`_ | +| | - `label_attr`_ | +| | - `mapped`_ | +| | - `max`_ | +| | - `min`_ | +| | - `required`_ | ++-------------+---------------------------------------------------------------------+ +| Parent type | :doc:`text ` | ++-------------+---------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType` | ++-------------+---------------------------------------------------------------------+ + +Basic Usage +----------- + + +Inherited Options +----------------- + +These options inherit from the :doc:`form ` +type: + +.. include:: /reference/forms/types/options/attr.rst.inc + +.. include:: /reference/forms/types/options/disabled.rst.inc + +.. include:: /reference/forms/types/options/error_bubbling.rst.inc + +.. include:: /reference/forms/types/options/error_mapping.rst.inc + +.. include:: /reference/forms/types/options/label.rst.inc + +.. include:: /reference/forms/types/options/label_attr.rst.inc + +.. include:: /reference/forms/types/options/mapped.rst.inc + +.. include:: /reference/forms/types/options/read_only.rst.inc + +.. include:: /reference/forms/types/options/required.rst.inc From a2c3f210e8c59d034a51c444d6eb3c5a34fb531a Mon Sep 17 00:00:00 2001 From: Hari KT Date: Sun, 28 Jun 2015 22:07:10 +0530 Subject: [PATCH 07/15] Make the necessary changes mentioned by @xabbuh and add example for form --- reference/forms/types/range.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/reference/forms/types/range.rst b/reference/forms/types/range.rst index 8be30c3f639..f2857c99eee 100644 --- a/reference/forms/types/range.rst +++ b/reference/forms/types/range.rst @@ -8,7 +8,7 @@ The ``range`` field is a slider that is rendered using the HTML5 ```` tag. +-------------+---------------------------------------------------------------------+ -| Rendered as | ``input`` ``range`` field (slider in html5 supported browser) | +| Rendered as | ``input`` ``range`` field (slider in HTML5 supported browser) | +-------------+---------------------------------------------------------------------+ | Inherited | - `data`_ | | options | - `disabled`_ | @@ -18,8 +18,7 @@ The ``range`` field is a slider that is rendered using the HTML5 | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `max`_ | -| | - `min`_ | +| | - `attr`_ | | | - `required`_ | +-------------+---------------------------------------------------------------------+ | Parent type | :doc:`text ` | @@ -30,6 +29,12 @@ The ``range`` field is a slider that is rendered using the HTML5 Basic Usage ----------- + $builder->add('name', 'range', array( + 'attr' => array( + 'min' => 5, + 'max' => 50 + ) + )); Inherited Options ----------------- From bef92eccccd639affee3fdde8d850a2484f3216e Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 1 Jul 2015 09:39:56 +0200 Subject: [PATCH 08/15] Added June changelog --- changelog.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.rst b/changelog.rst index 9444def5556..0a842a17e8a 100644 --- a/changelog.rst +++ b/changelog.rst @@ -20,6 +20,7 @@ New Documentation ~~~~~~~~~~~~~~~~~ * `#5423 `_ [Security] add & update doc entries on AbstractVoter implementation (Inoryy, javiereguiluz) +* `#5409 `_ [Reference] document new Doctrine APC cache service (xabbuh) * `#5401 `_ Added some more docs about the remember me feature (WouterJ) * `#5384 `_ Added information about the new date handling in the comparison constraints and Range (webmozart, javiereguiluz) * `#5382 `_ Added support for standard Forwarded header (tony-co, javiereguiluz) @@ -27,6 +28,7 @@ New Documentation * `#5332 `_ [Serializer] ObjectNormalizer, object_to_populate doc. Minor enhancements. (dunglas) * `#5335 `_ [Serializer] Updated the cookbook. (dunglas) * `#5313 `_ Documented the overridden form options (javiereguiluz) +* `#5360 `_ [Serializer] Array Denormalization (derrabus) * `#5307 `_ Update data_transformers.rst (zebba) * `#5186 `_ Added a new article about using/installing unstable Symfony versions (javiereguiluz) * `#5166 `_ Proposed a new article about using pure PHP libraries with Assetic (javiereguiluz) @@ -42,6 +44,7 @@ New Documentation * `#5355 `_ Added a mention to the Symfony Demo application (javiereguiluz) * `#5331 `_ [PSR-7] Bridge documentation (dunglas) * `#5373 `_ Added mentions to some popular (and useful) Symfony bundles (javiereguiluz) +* `#4354 `_ [WCM] Added depreciation note for the cascade_validation constraint (peterrehm) Fixed Documentation ~~~~~~~~~~~~~~~~~~~ @@ -88,6 +91,7 @@ Minor Documentation Changes * `#5381 `_ remove Yoda condition (greg0ire) * `#5452 `_ [#5388] change echo and print in examples (snoek09) * `#5451 `_ [#5388] change echo and print in examples (snoek09) +* `#3782 `_ [Form] Deprecate read_only option (snoob) * `#5432 `_ removed squashing stuff. fixes #5368 (OskarStark) * `#5383 `_ Reword a paragraph about service configurations (richardudovich) * `#5389 `_ Updates to security.rst (HexTitan) From 3c6ff76053f79646d581482018a64d4c838104c9 Mon Sep 17 00:00:00 2001 From: Hari KT Date: Fri, 3 Jul 2015 17:02:29 +0530 Subject: [PATCH 09/15] Fix issues reported by @snoek09 . Thank you. --- reference/forms/types.rst | 1 + reference/forms/types/map.rst.inc | 1 + reference/forms/types/range.rst | 23 +++++++++++++++++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/reference/forms/types.rst b/reference/forms/types.rst index 413c5bc2bc4..5df657d1910 100644 --- a/reference/forms/types.rst +++ b/reference/forms/types.rst @@ -18,6 +18,7 @@ Form Types Reference types/percent types/search types/url + types/range types/choice types/entity diff --git a/reference/forms/types/map.rst.inc b/reference/forms/types/map.rst.inc index b4362b3f318..2fbc4ae1f4d 100644 --- a/reference/forms/types/map.rst.inc +++ b/reference/forms/types/map.rst.inc @@ -11,6 +11,7 @@ Text Fields * :doc:`percent ` * :doc:`search ` * :doc:`url ` +* :doc:`url ` Choice Fields ~~~~~~~~~~~~~ diff --git a/reference/forms/types/range.rst b/reference/forms/types/range.rst index f2857c99eee..750b07d760a 100644 --- a/reference/forms/types/range.rst +++ b/reference/forms/types/range.rst @@ -10,16 +10,17 @@ The ``range`` field is a slider that is rendered using the HTML5 +-------------+---------------------------------------------------------------------+ | Rendered as | ``input`` ``range`` field (slider in HTML5 supported browser) | +-------------+---------------------------------------------------------------------+ -| Inherited | - `data`_ | -| options | - `disabled`_ | +| Inherited | - `attr`_ | +| options | - `data`_ | +| | - `disabled`_ | | | - `empty_data`_ | | | - `error_bubbling`_ | | | - `error_mapping`_ | | | - `label`_ | | | - `label_attr`_ | | | - `mapped`_ | -| | - `attr`_ | | | - `required`_ | +| | - `trim`_ | +-------------+---------------------------------------------------------------------+ | Parent type | :doc:`text ` | +-------------+---------------------------------------------------------------------+ @@ -29,6 +30,8 @@ The ``range`` field is a slider that is rendered using the HTML5 Basic Usage ----------- +.. code-block:: php + $builder->add('name', 'range', array( 'attr' => array( 'min' => 5, @@ -44,18 +47,26 @@ type: .. include:: /reference/forms/types/options/attr.rst.inc +.. include:: /reference/forms/types/options/data.rst.inc + .. include:: /reference/forms/types/options/disabled.rst.inc +.. include:: /reference/forms/types/options/empty_data.rst.inc + :end-before: DEFAULT_PLACEHOLDER + +The default value is ``''`` (the empty string). + +.. include:: /reference/forms/types/options/empty_data.rst.inc + :start-after: DEFAULT_PLACEHOLDER + .. include:: /reference/forms/types/options/error_bubbling.rst.inc .. include:: /reference/forms/types/options/error_mapping.rst.inc .. include:: /reference/forms/types/options/label.rst.inc -.. include:: /reference/forms/types/options/label_attr.rst.inc - .. include:: /reference/forms/types/options/mapped.rst.inc -.. include:: /reference/forms/types/options/read_only.rst.inc +.. include:: /reference/forms/types/options/label_attr.rst.inc .. include:: /reference/forms/types/options/required.rst.inc From abf3e8eed4d268e0552c4e21f5fe508a58ebe355 Mon Sep 17 00:00:00 2001 From: Hari KT Date: Fri, 3 Jul 2015 17:10:38 +0530 Subject: [PATCH 10/15] Fix the rendering issue --- reference/forms/types/map.rst.inc | 2 +- reference/forms/types/range.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/reference/forms/types/map.rst.inc b/reference/forms/types/map.rst.inc index 2fbc4ae1f4d..de0e07db282 100644 --- a/reference/forms/types/map.rst.inc +++ b/reference/forms/types/map.rst.inc @@ -11,7 +11,7 @@ Text Fields * :doc:`percent ` * :doc:`search ` * :doc:`url ` -* :doc:`url ` +* :doc:`range ` Choice Fields ~~~~~~~~~~~~~ diff --git a/reference/forms/types/range.rst b/reference/forms/types/range.rst index 750b07d760a..7fe92d88b39 100644 --- a/reference/forms/types/range.rst +++ b/reference/forms/types/range.rst @@ -70,3 +70,5 @@ The default value is ``''`` (the empty string). .. include:: /reference/forms/types/options/label_attr.rst.inc .. include:: /reference/forms/types/options/required.rst.inc + +.. include:: /reference/forms/types/options/trim.rst.inc From 28630799385ea0a16cbd3ea18e0cc9fb595b131a Mon Sep 17 00:00:00 2001 From: Hari KT Date: Sat, 4 Jul 2015 12:03:51 +0530 Subject: [PATCH 11/15] Fix moving the mapped down as per @xabbuh --- reference/forms/types/range.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/range.rst b/reference/forms/types/range.rst index 7fe92d88b39..31795c809d1 100644 --- a/reference/forms/types/range.rst +++ b/reference/forms/types/range.rst @@ -65,10 +65,10 @@ The default value is ``''`` (the empty string). .. include:: /reference/forms/types/options/label.rst.inc -.. include:: /reference/forms/types/options/mapped.rst.inc - .. include:: /reference/forms/types/options/label_attr.rst.inc +.. include:: /reference/forms/types/options/mapped.rst.inc + .. include:: /reference/forms/types/options/required.rst.inc .. include:: /reference/forms/types/options/trim.rst.inc From 99a996c1696bfd57b2f9b24c536dd623fc951c6e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 7 Jul 2015 12:54:36 +0200 Subject: [PATCH 12/15] Added caution notes about the deprecation of container scopes --- cookbook/console/console_command.rst | 5 +++++ cookbook/service_container/scopes.rst | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index 2bc6e430ee8..9a6d40f76b7 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -82,6 +82,11 @@ for details. Getting Services from the Service Container ------------------------------------------- +.. caution:: + + The "container scopes" concept explained in this section has been deprecated + in Symfony 2.8 and it will be removed in Symfony 3.0. + By using :class:`Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerAwareCommand` as the base class for the command (instead of the more basic :class:`Symfony\\Component\\Console\\Command\\Command`), you have access to the diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index bac6281a3e0..13d35e4cc1e 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -4,6 +4,11 @@ How to Work with Scopes ======================= +.. caution:: + + The "container scopes" concept explained in this article has been deprecated + in Symfony 2.8 and it will be removed in Symfony 3.0. + This article is all about scopes, a somewhat advanced topic related to the :doc:`/book/service_container`. If you've ever gotten an error mentioning "scopes" when creating services, then this article is for you. From b88a17e3255744631f9a5267366b067a4b5c59be Mon Sep 17 00:00:00 2001 From: Vincent AUBERT Date: Tue, 14 Jul 2015 21:27:55 +0200 Subject: [PATCH 13/15] [Cookbook][WebServer] #5504 add a tip for the --force option on server:start --- cookbook/web_server/built_in.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cookbook/web_server/built_in.rst b/cookbook/web_server/built_in.rst index 33289907614..ab8e3635452 100644 --- a/cookbook/web_server/built_in.rst +++ b/cookbook/web_server/built_in.rst @@ -39,6 +39,15 @@ can change the socket passing an IP address and a port as a command-line argumen $ php app/console server:run 192.168.0.1:8080 +.. note:: + + You can use the ``--force`` option to force the web server start + if the process wasn't correctly stopped (without using the ``server:stop`` command). + + .. code-block:: bash + + $ php app/console server:start --force + .. note:: You can use the ``server:status`` command to check if a web server is From 17395493589902d1e722ef4978d47ecfa65e6496 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Thu, 23 Jul 2015 12:34:17 +0200 Subject: [PATCH 14/15] [#5521] Added versionadded directive --- cookbook/web_server/built_in.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cookbook/web_server/built_in.rst b/cookbook/web_server/built_in.rst index ab8e3635452..e182601e4a2 100644 --- a/cookbook/web_server/built_in.rst +++ b/cookbook/web_server/built_in.rst @@ -48,6 +48,9 @@ can change the socket passing an IP address and a port as a command-line argumen $ php app/console server:start --force + .. versionadded:: 2.8 + The ``--force`` option was introduced in Symfony 2.8. + .. note:: You can use the ``server:status`` command to check if a web server is From 09fe35f818d969f7ef117f50e25293324c400459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20R?= Date: Mon, 23 Mar 2015 00:23:45 +0100 Subject: [PATCH 15/15] [HttpKernel] Added support for registering Bundle dependencies Doc for : https://github.com/symfony/symfony/pull/15011 --- cookbook/bundles/dependencies.rst | 97 +++++++++++++++++++++++++++++++ cookbook/bundles/index.rst | 1 + cookbook/map.rst.inc | 1 + 3 files changed, 99 insertions(+) create mode 100644 cookbook/bundles/dependencies.rst diff --git a/cookbook/bundles/dependencies.rst b/cookbook/bundles/dependencies.rst new file mode 100644 index 00000000000..d86edffe869 --- /dev/null +++ b/cookbook/bundles/dependencies.rst @@ -0,0 +1,97 @@ +.. index:: + single: Bundle; Dependencies + +How to Use Bundle Dependencies to Load other Bundles +==================================================== + +.. versionadded:: 2.8 + Support for bundle dependencies was introduced in Symfony 2.8. + +When working on your own bundle(s), you'll sometimes have the need to reuse +other bundles, either by just requiring, overriding or inheriting from them. + +While Composer takes care about making sure these dependencies are loaded, +you'll also need to enable these bundles in the kernel. + +If your bundle is meant to be reused, bundle dependencies will complicate +your installation documentation. This makes installation and upgrading your +bundle more tedious for your users. + +You can avoid this by specifying your dependencies. This will make sure that +they are loaded in the kernel. It'll also make sure they are loaded *before* +your own bundle, to make sure you can extend them. + +Additional use case for this is for distribution bundle use cases where one +bundle is in fact bundling several others. + +Specifying dependencies +----------------------- + +Dependencies are specified using a Fully Qualified Name for the bundle class in same +format as PHP uses for ``get_class`` and for ``class`` constant introduced in PHP 5.5. + +This implies you can only specify bundles that does not take arguments in it's constructor. +This is in-line with Symfony best practice and furthermore avoids same bundle being loaded +several times. + +Specifying dependencies is accomplished by implementing the +:class:`Symfony\\Component\\HttpKernel\\Bundle\\BundleDependenciesInterface`:: + + // src/CacheBundle/CacheBundle.php + namespace CacheBundle; + + use Symfony\Component\HttpKernel\Bundle\Bundle; + use Symfony\Component\HttpKernel\Bundle\BundleDependenciesInterface; + + class CacheBundle extends Bundle implements BundleDependenciesInterface + { + public function getBundleDependencies($environment, $debug) + { + return array('FOS\HttpCacheBundle\FOSHttpCacheBundle' => self::DEP_REQUIRED); + } + } + +.. tip:: + + If your bundle requires PHP 5.5 or higher, you can also take advantage of + the ``class`` constant:: + + use FOS\HttpCacheBundle\FOSHttpCacheBundle; + + // ... + public function getBundleDependencies($environment, $debug) + { + return array(FOSHttpCacheBundle::class => self::DEP_REQUIRED); + } + +.. tip:: + + If your dependency is only to be loaded in ``dev`` or when debugging use the provided arguments:: + + use Egulias\SecurityDebugCommandBundle\EguliasSecurityDebugCommandBundle; + + // ... + public function getBundleDependencies($environment, $debug) + { + if ($environment !== 'dev') + return array(); + + return array('Egulias\SecurityDebugCommandBundle\EguliasSecurityDebugCommandBundle' => self::DEP_REQUIRED); + } + + +Specifying optional dependencies +-------------------------------- + +Specifying a optional dependency follows the same format but with a different constant:: + + // ... + public function getBundleDependencies($environment, $debug) + { + return array('Oneup\FlysystemBundle\OneupFlysystemBundle' => self::DEP_OPTIONAL); + } + + .. tip:: + + Make sure to not use PHP's ``class`` constant in combination with optional dependencies as that effectively will + make PHP error when they are missing. \ No newline at end of file diff --git a/cookbook/bundles/index.rst b/cookbook/bundles/index.rst index 87641de5e23..d6d61ce2415 100644 --- a/cookbook/bundles/index.rst +++ b/cookbook/bundles/index.rst @@ -7,6 +7,7 @@ Bundles installation best_practices inheritance + dependencies override remove extension diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 8049b6b320d..db0f53e2f61 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -12,6 +12,7 @@ * :doc:`/cookbook/bundles/installation` * :doc:`/cookbook/bundles/best_practices` * :doc:`/cookbook/bundles/inheritance` + * :doc:`/cookbook/bundles/dependencies` * :doc:`/cookbook/bundles/override` * :doc:`/cookbook/bundles/remove` * :doc:`/cookbook/bundles/extension`