diff --git a/changelog.rst b/changelog.rst index 49cac73caa7..19308c7c0ca 100644 --- a/changelog.rst +++ b/changelog.rst @@ -12,6 +12,8 @@ documentation. Do you also want to participate in the Symfony Documentation? Take a look at the ":doc:`/contributing/documentation/overview`" article. +<<<<<<< HEAD +<<<<<<< HEAD August, 2015 ------------ @@ -38,6 +40,7 @@ Minor Documentation Changes * `#5553 `_ Fix all broken links/permanent redirects/removed anchors (WouterJ) * `#5650 `_ [RFR] fixing typo and removing duplicated lines in Config component doc (salahm) * `#5635 `_ Fix minor problems in book/page_creation.rst (fabschurt) +* `#5579 `_ [3.0] Remove mentions of Symfony1 (WouterJ) * `#5647 `_ don't ignore the _exts directory anymore (xabbuh) * `#5587 `_ [2.6] Don't use deprecated features (WouterJ) * `#5637 `_ Add QueryBuilder vs DQL section (bocharsky-bw) @@ -71,13 +74,16 @@ July, 2015 New Documentation ~~~~~~~~~~~~~~~~~ +* `#5374 `_ Remove deprecated parameters (norkunas) * `#5533 `_ Replace Capifony with Capistrano/symfony (mojzis) * `#5543 `_ Add deprecation notice to "choice_list" option of ChoiceType (XitasoChris) +* `#5521 `_ [Cookbook][WebServer] #5504 add a tip for the --force option (vincentaubert) * `#5516 `_ Added a note about session data size in PdoSessionHandler (javiereguiluz) * `#5499 `_ The "property" option of DoctrineType was deprecated. (XWB) * `#5491 `_ added composer info (OskarStark) * `#5478 `_ Add cookbook article for using MongoDB to store session data (stevenmusumeche) * `#5472 `_ Added a tip about hashing the result of nextBytes() (javiereguiluz) +* `#5458 `_ HTML5 range documentation (harikt) * `#5453 `_ Cleanup security voters cookbook recipes (WouterJ) * `#5444 `_ Documented the "auto_alias" feature (javiereguiluz) * `#5201 `_ [Book][Routing] Add example about how to match multiple methods (xelaris) @@ -106,6 +112,7 @@ Minor Documentation Changes * `#5580 `_ Additional User check in voter class (weaverryan) * `#5573 `_ fix YAML syntax highlighting (xabbuh) * `#5564 `_ Improve and simplify the contributing instructions about tests (javiereguiluz) +* `#5498 `_ [WIP] Added caution notes about the deprecation of container scopes (javiereguiluz) * `#5550 `_ [docbot] Reviewed some component chapters (WouterJ) * `#5556 `_ Fix typo Esi in part create framework (nicolasdewez) * `#5568 `_ [Create Framework] Fix extract calls (replaces #5522) (kenjis) @@ -158,6 +165,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) @@ -165,6 +173,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) @@ -180,6 +189,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 ~~~~~~~~~~~~~~~~~~~ @@ -226,6 +236,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) @@ -499,9 +510,15 @@ Minor Documentation Changes - `3be0081 `_ #4976 Improved sentence (edsonmedina) - `a444220 `_ #4885 Fix typos (ifdattic) - `482502d `_ #4793 [Contributing] Several tweaks (xelaris) +- `a2395ef `_ #5054 [Changelog] fix changelog syntax (xabbuh) - `6b66f03 `_ #5003 Updated the generic Deployment article (javiereguiluz) - `39a1487 `_ #4999 Fixed semantic error (beni0888) +======= +>>>>>>> Added February changelog +======= + +>>>>>>> fix changelog syntax February, 2015 -------------- @@ -539,7 +556,10 @@ Minor Documentation Changes - `1726054 `_ #4500 Link to standard edition (harikt) - `91ff6f8 `_ #4329 ensure consistency with the note (greg0ire) - `f4ab4b6 `_ #5002 Revert very bad merge (WouterJ) +<<<<<<< HEAD - `e747392 `_ Revert "#4977 Unnecessary comma (edsonmedina)" +======= +>>>>>>> Added February changelog - `e5dbd49 `_ #4977 Unnecessary comma (edsonmedina) - `ed80100 `_ #4977 Unnecessary comma (edsonmedina) - `5d44987 `_ #4991 Fixed typo and tweaked syntax. (cdvrooman) 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/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/email/dev_environment.rst b/cookbook/email/dev_environment.rst index d5dbabba918..a2de8333080 100644 --- a/cookbook/email/dev_environment.rst +++ b/cookbook/email/dev_environment.rst @@ -1,5 +1,5 @@ .. index:: - single: Emails; In development +single: Emails; In development How to Work with Emails during Development ========================================== diff --git a/cookbook/event_dispatcher/before_after_filters.rst b/cookbook/event_dispatcher/before_after_filters.rst index 2b7d25d6a9d..8490884a798 100644 --- a/cookbook/event_dispatcher/before_after_filters.rst +++ b/cookbook/event_dispatcher/before_after_filters.rst @@ -8,10 +8,10 @@ It is quite common in web application development to need some logic to be executed just before or just after your controller actions acting as filters or hooks. -In symfony1, this was achieved with the preExecute and postExecute methods. -Most major frameworks have similar methods but there is no such thing in Symfony. -The good news is that there is a much better way to interfere with the -Request -> Response process using the :doc:`EventDispatcher component `. +Some web frameworks define methods like ``preExecute()`` and ``postExecute()``, +but there is no such thing in Symfony. The good news is that there is a much +better way to interfere with the Request -> Response process using the +:doc:`EventDispatcher component `. Token Validation Example ------------------------ diff --git a/cookbook/index.rst b/cookbook/index.rst index bdf414d6177..ba0f13c6fc1 100644 --- a/cookbook/index.rst +++ b/cookbook/index.rst @@ -29,7 +29,6 @@ The Cookbook service_container/index session/index psr7 - symfony1 templating/index testing/index upgrade/index diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 8049b6b320d..6f48c8247ae 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -211,10 +211,6 @@ * :doc:`/cookbook/psr7` -* **symfony1** - - * :doc:`/cookbook/symfony1` - * :doc:`/cookbook/templating/index` * :doc:`/cookbook/templating/global_variables` 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/symfony1.rst b/cookbook/symfony1.rst deleted file mode 100644 index b800914a661..00000000000 --- a/cookbook/symfony1.rst +++ /dev/null @@ -1,369 +0,0 @@ -.. index:: - single: symfony1 - -How Symfony2 Differs from Symfony1 -================================== - -The Symfony2 Framework embodies a significant evolution when compared with -the first version of the framework. Fortunately, with the MVC architecture -at its core, the skills used to master a symfony1 project continue to be -very relevant when developing in Symfony2. Sure, ``app.yml`` is gone, but -routing, controllers and templates all remain. - -This chapter walks through the differences between symfony1 and Symfony2. -As you'll see, many tasks are tackled in a slightly different way. You'll -come to appreciate these minor differences as they promote stable, predictable, -testable and decoupled code in your Symfony2 applications. - -So, sit back and relax as you travel from "then" to "now". - -Directory Structure -------------------- - -When looking at a Symfony2 project - for example, the `Symfony Standard Edition`_ - -you'll notice a very different directory structure than in symfony1. The -differences, however, are somewhat superficial. - -The ``app/`` Directory -~~~~~~~~~~~~~~~~~~~~~~ - -In symfony1, your project has one or more applications, and each lives inside -the ``apps/`` directory (e.g. ``apps/frontend``). By default in Symfony2, -you have just one application represented by the ``app/`` directory. Like -in symfony1, the ``app/`` directory contains configuration specific to that -application. It also contains application-specific cache, log and template -directories as well as a ``Kernel`` class (``AppKernel``), which is the base -object that represents the application. - -Unlike symfony1, almost no PHP code lives in the ``app/`` directory. This -directory is not meant to house modules or library files as it did in symfony1. -Instead, it's simply the home of configuration and other resources (templates, -translation files). - -The ``src/`` Directory -~~~~~~~~~~~~~~~~~~~~~~ - -Put simply, your actual code goes here. In Symfony2, all actual application-code -lives inside a bundle (roughly equivalent to a symfony1 plugin) and, by default, -each bundle lives inside the ``src`` directory. In that way, the ``src`` -directory is a bit like the ``plugins`` directory in symfony1, but much more -flexible. Additionally, while *your* bundles will live in the ``src/`` directory, -third-party bundles will live somewhere in the ``vendor/`` directory. - -To get a better picture of the ``src/`` directory, first think of the structure -of a symfony1 application. First, part of your code likely lives inside one or -more applications. Most commonly these include modules, but could also include -any other PHP classes you put in your application. You may have also created -a ``schema.yml`` file in the ``config`` directory of your project and built -several model files. Finally, to help with some common functionality, you're -using several third-party plugins that live in the ``plugins/`` directory. -In other words, the code that drives your application lives in many different -places. - -In Symfony2, life is much simpler because *all* Symfony2 code must live in -a bundle. In the pretend symfony1 project, all the code *could* be moved -into one or more plugins (which is a very good practice, in fact). Assuming -that all modules, PHP classes, schema, routing configuration, etc. were moved -into a plugin, the symfony1 ``plugins/`` directory would be very similar -to the Symfony2 ``src/`` directory. - -Put simply again, the ``src/`` directory is where your code, assets, -templates and most anything else specific to your project will live. - -The ``vendor/`` Directory -~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ``vendor/`` directory is basically equivalent to the ``lib/vendor/`` -directory in symfony1, which was the conventional directory for all vendor -libraries and bundles. By default, you'll find the Symfony2 library files in -this directory, along with several other dependent libraries such as Doctrine2, -Twig and Swift Mailer. 3rd party Symfony2 bundles live somewhere in the -``vendor/``. - -The ``web/`` Directory -~~~~~~~~~~~~~~~~~~~~~~ - -Not much has changed in the ``web/`` directory. The most noticeable difference -is the absence of the ``css/``, ``js/`` and ``images/`` directories. This -is intentional. Like with your PHP code, all assets should also live inside -a bundle. With the help of a console command, the ``Resources/public/`` -directory of each bundle is copied or symbolically-linked to the ``web/bundles/`` -directory. This allows you to keep assets organized inside your bundle, but -still make them available to the public. To make sure that all bundles are -available, run the following command: - -.. code-block:: bash - - $ php app/console assets:install web - -.. note:: - - This command is the Symfony2 equivalent to the symfony1 ``plugin:publish-assets`` - command. - -Autoloading ------------ - -One of the advantages of modern frameworks is never needing to worry about -requiring files. By making use of an autoloader, you can refer to any class -in your project and trust that it's available. Autoloading has changed in -Symfony2 to be more universal, faster, and independent of needing to clear -your cache. - -In symfony1, autoloading was done by searching the entire project for the -presence of PHP class files and caching this information in a giant array. -That array told symfony1 exactly which file contained each class. In the -production environment, this caused you to need to clear the cache when classes -were added or moved. - -In Symfony2, a tool named `Composer`_ handles this process. -The idea behind the autoloader is simple: the name of your class (including -the namespace) must match up with the path to the file containing that class. -Take the FrameworkExtraBundle from the Symfony2 Standard Edition as an -example:: - - namespace Sensio\Bundle\FrameworkExtraBundle; - - use Symfony\Component\HttpKernel\Bundle\Bundle; - // ... - - class SensioFrameworkExtraBundle extends Bundle - { - // ... - } - -The file itself lives at -``vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/SensioFrameworkExtraBundle.php``. -As you can see, the second part of the path follows the namespace of the -class. The first part is equal to the package name of the SensioFrameworkExtraBundle. - -The namespace, ``Sensio\Bundle\FrameworkExtraBundle``, and package name, -``sensio/framework-extra-bundle``, spells out the directory that the file -should live in -(``vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/``). -Composer can then look for the file at this specific place and load it very -fast. - -If the file did *not* live at this exact location, you'd receive a -``Class "Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle" does not exist.`` -error. In Symfony2, a "class does not exist" error means that the namespace of -the class and physical location do not match. Basically, Symfony2 is looking -in one exact location for that class, but that location doesn't exist (or -contains a different class). In order for a class to be autoloaded, you -**never need to clear your cache** in Symfony2. - -As mentioned before, for the autoloader to work, it needs to know that the -``Sensio`` namespace lives in the ``vendor/sensio/framework-extra-bundle`` -directory and that, for example, the ``Doctrine`` namespace lives in the -``vendor/doctrine/orm/lib/`` directory. This mapping is entirely controlled by -Composer. Each third-party library you load through Composer has its -settings defined and Composer takes care of everything for you. - -For this to work, all third-party libraries used by your project must be -defined in the ``composer.json`` file. - -If you look at the ``HelloController`` from the Symfony Standard Edition you -can see that it lives in the ``Acme\DemoBundle\Controller`` namespace. Yet, the -AcmeDemoBundle is not defined in your ``composer.json`` file. Nonetheless are -the files autoloaded. This is because you can tell Composer to autoload files -from specific directories without defining a dependency: - -.. code-block:: json - - "autoload": { - "psr-0": { "": "src/" } - } - -This means that if a class is not found in the ``vendor`` directory, Composer -will search in the ``src`` directory before throwing a "class does not exist" -exception. Read more about configuring the Composer autoloader in -`the Composer documentation`_. - -Using the Console ------------------ - -In symfony1, the console is in the root directory of your project and is -called ``symfony``: - -.. code-block:: bash - - $ php symfony - -In Symfony2, the console is now in the app sub-directory and is called -``console``: - -.. code-block:: bash - - $ php app/console - -Applications ------------- - -In a symfony1 project, it is common to have several applications: one for the -front-end and one for the back-end for instance. - -In a Symfony2 project, you only need to create one application (a blog -application, an intranet application, ...). Most of the time, if you want to -create a second application, you might instead create another project and -share some bundles between them. - -And if you need to separate the front-end and the back-end features of some -bundles, you can create sub-namespaces for controllers, sub-directories for -templates, different semantic configurations, separate routing configurations, -and so on. - -Of course, there's nothing wrong with having multiple applications in your -project, that's entirely up to you. A second application would mean a new -directory, e.g. ``my_app/``, with the same basic setup as the ``app/`` directory. - -.. tip:: - - Read the definition of a :term:`Project`, an :term:`Application`, and a - :term:`Bundle` in the glossary. - -Bundles and Plugins -------------------- - -In a symfony1 project, a plugin could contain configuration, modules, PHP -libraries, assets and anything else related to your project. In Symfony2, -the idea of a plugin is replaced by the "bundle". A bundle is even more powerful -than a plugin because the core Symfony2 Framework is brought in via a series -of bundles. In Symfony2, bundles are first-class citizens that are so flexible -that even core code itself is a bundle. - -In symfony1, a plugin must be enabled inside the ``ProjectConfiguration`` -class:: - - // config/ProjectConfiguration.class.php - public function setup() - { - // some plugins here - $this->enableAllPluginsExcept(array(...)); - } - -In Symfony2, the bundles are activated inside the application kernel:: - - // app/AppKernel.php - public function registerBundles() - { - $bundles = array( - new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), - new Symfony\Bundle\TwigBundle\TwigBundle(), - ..., - new Acme\DemoBundle\AcmeDemoBundle(), - ); - - return $bundles; - } - -Routing (``routing.yml``) and Configuration (``config.yml``) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In symfony1, the ``routing.yml`` and ``app.yml`` configuration files were -automatically loaded inside any plugin. In Symfony2, routing and application -configuration inside a bundle must be included manually. For example, to -include a routing resource from a bundle called AcmeDemoBundle, you can -do the following: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/routing.yml - _hello: - resource: "@AcmeDemoBundle/Resources/config/routing.yml" - - .. code-block:: xml - - - - - - - - - - .. code-block:: php - - // app/config/routing.php - use Symfony\Component\Routing\RouteCollection; - - $collection = new RouteCollection(); - $collection->addCollection($loader->import("@AcmeHelloBundle/Resources/config/routing.php")); - - return $collection; - -This will load the routes found in the ``Resources/config/routing.yml`` file -of the AcmeDemoBundle. The special ``@AcmeDemoBundle`` is a shortcut syntax -that, internally, resolves to the full path to that bundle. - -You can use this same strategy to bring in configuration from a bundle: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config.yml - imports: - - { resource: "@AcmeDemoBundle/Resources/config/config.yml" } - - .. code-block:: xml - - - - - - - .. code-block:: php - - // app/config/config.php - $this->import('@AcmeDemoBundle/Resources/config/config.php') - -In Symfony2, configuration is a bit like ``app.yml`` in symfony1, except much -more systematic. With ``app.yml``, you could simply create any keys you wanted. -By default, these entries were meaningless and depended entirely on how you -used them in your application: - -.. code-block:: yaml - - # some app.yml file from symfony1 - all: - email: - from_address: foo.bar@example.com - -In Symfony2, you can also create arbitrary entries under the ``parameters`` -key of your configuration: - -.. configuration-block:: - - .. code-block:: yaml - - parameters: - email.from_address: foo.bar@example.com - - .. code-block:: xml - - - foo.bar@example.com - - - .. code-block:: php - - $container->setParameter('email.from_address', 'foo.bar@example.com'); - -You can now access this from a controller, for example:: - - public function helloAction($name) - { - $fromAddress = $this->container->getParameter('email.from_address'); - } - -In reality, the Symfony2 configuration is much more powerful and is used -primarily to configure objects that you can use. For more information, see -the chapter titled ":doc:`/book/service_container`". - -.. _`Composer`: https://getcomposer.org -.. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard -.. _`the Composer documentation`: https://getcomposer.org/doc/04-schema.md#autoload diff --git a/cookbook/web_server/built_in.rst b/cookbook/web_server/built_in.rst index 0ad6230a0cd..642531ed0ca 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 1a4a45d094d..d30e6cf6c39 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1374,7 +1374,16 @@ 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`. +<<<<<<< HEAD .. _reference-validation-enable_annotations: +======= +.. 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. +>>>>>>> document new Doctrine APC cache service 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 2d2f4748106..5fa7d19b720 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 2a723382d4e..c1ddaf47ed0 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 ae322be16f6..cec92232cea 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`_ | +-------------+-------------------------------------------------------------------+ diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 729887cb342..7e488e6587c 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -98,16 +98,19 @@ asset .. code-block:: jinja - {{ asset(path, packageName, absolute = false, version = null) }} + {{ asset(path, packageName = null) }} ``path`` **type**: ``string`` ``packageName`` **type**: ``string`` | ``null`` **default**: ``null`` +<<<<<<< HEAD ``absolute`` (deprecated as of 2.7) **type**: ``boolean`` **default**: ``false`` ``version`` (deprecated as of 2.7) **type**: ``string`` **default** ``null`` +======= +>>>>>>> Remove deprecated parameters Returns a public path to ``path``, which takes into account the base path set for the package and the URL path. More information in