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) diff --git a/components/serializer.rst b/components/serializer.rst index 235ce8acf58..14512852b91 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -632,6 +632,55 @@ having unique identifiers:: var_dump($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 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/console/console_command.rst b/cookbook/console/console_command.rst index 184c51e541d..7e23a4762a4 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/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` 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. diff --git a/cookbook/web_server/built_in.rst b/cookbook/web_server/built_in.rst index 33289907614..e182601e4a2 100644 --- a/cookbook/web_server/built_in.rst +++ b/cookbook/web_server/built_in.rst @@ -39,6 +39,18 @@ 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 + + .. 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 diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index d352a86f06b..a7e502e9b75 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1374,6 +1374,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. + .. _reference-validation-enable_annotations: enable_annotations diff --git a/reference/forms/twig_reference.rst b/reference/forms/twig_reference.rst index 71f6802ef6b..008bee33e00 100644 --- a/reference/forms/twig_reference.rst +++ b/reference/forms/twig_reference.rst @@ -358,8 +358,6 @@ done by using a public ``vars`` property on the +------------------------+-------------------------------------------------------------------------------------+ | ``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.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/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 b0c657a2add..3b45e55c582 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -23,7 +23,7 @@ true, 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 07f80d3cf3c..69079e4168d 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 557f497676c..e7b7226c067 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 1a8543b7dbe..05201597312 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 25816551d42..a4fda47bba1 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -42,7 +42,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 da352ec00cf..58471e175b8 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -45,7 +45,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 5aabfdd5f23..58faabc5ea2 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 aac88bc7627..0a1e6f534f4 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -21,7 +21,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 2ccb0debf17..b5409100f4b 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`_ | @@ -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 1b32e43b3f5..b2d4348861e 100644 --- a/reference/forms/types/integer.rst +++ b/reference/forms/types/integer.rst @@ -33,7 +33,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 dd00048f977..621dc08b3cd 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 ba6a82831e5..5937f73c894 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/map.rst.inc b/reference/forms/types/map.rst.inc index b4362b3f318..de0e07db282 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:`range ` Choice Fields ~~~~~~~~~~~~~ diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index 06737a3c679..8f89f682108 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -32,7 +32,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 a60746824b0..59094ac1bb9 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -28,7 +28,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/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 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 137d0c70dcc..3e971ff113f 100644 --- a/reference/forms/types/password.rst +++ b/reference/forms/types/password.rst @@ -22,7 +22,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`_ | +-------------+------------------------------------------------------------------------+ | Parent type | :doc:`text ` | diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst index 843b65f66f2..0efc8c7c2c2 100644 --- a/reference/forms/types/percent.rst +++ b/reference/forms/types/percent.rst @@ -31,7 +31,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/range.rst b/reference/forms/types/range.rst new file mode 100644 index 00000000000..31795c809d1 --- /dev/null +++ b/reference/forms/types/range.rst @@ -0,0 +1,74 @@ +.. 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 | - `attr`_ | +| options | - `data`_ | +| | - `disabled`_ | +| | - `empty_data`_ | +| | - `error_bubbling`_ | +| | - `error_mapping`_ | +| | - `label`_ | +| | - `label_attr`_ | +| | - `mapped`_ | +| | - `required`_ | +| | - `trim`_ | ++-------------+---------------------------------------------------------------------+ +| Parent type | :doc:`text ` | ++-------------+---------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType` | ++-------------+---------------------------------------------------------------------+ + +Basic Usage +----------- + +.. code-block:: php + + $builder->add('name', 'range', array( + 'attr' => array( + 'min' => 5, + 'max' => 50 + ) + )); + +Inherited Options +----------------- + +These options inherit from the :doc:`form ` +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/required.rst.inc + +.. include:: /reference/forms/types/options/trim.rst.inc 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 63a0e41913c..38d1f784a8d 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 cc03943b183..bfbaa7e3428 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -39,7 +39,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 f675689ecdb..d23ba791b0b 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`_ | +-------------+-------------------------------------------------------------------+