From 265604b7a7aec3e8a58709bb4396a961e9e076f9 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 5 Nov 2014 11:55:06 -0500 Subject: [PATCH 01/23] [#4243] Tweaks to the new var-dumper component --- components/var_dumper/advanced.rst | 81 ++++++++++++++++++-------- components/var_dumper/introduction.rst | 39 +++++++++++-- 2 files changed, 91 insertions(+), 29 deletions(-) diff --git a/components/var_dumper/advanced.rst b/components/var_dumper/advanced.rst index 9b70c8fdfd4..6b6cbf4ebce 100644 --- a/components/var_dumper/advanced.rst +++ b/components/var_dumper/advanced.rst @@ -5,14 +5,30 @@ Advanced Usage of the VarDumper Component ========================================= -``dump()`` function is just a thin wrapper and a more convenient way to call +The ``dump()`` function is just a thin wrapper and a more convenient way to call :method:`VarDumper::dump() `. You can change the behavior of this function by calling -:method:`VarDumper::setHandler($callable) `: -calls to ``dump()`` will then be forwarded to ``$callable``. +:method:`VarDumper::setHandler($callable) `. +Calls to ``dump()`` will then be forwarded to ``$callable``. + +By adding a handler, you can customize the `Cloners`_, `Dumpers`_ and `Casters`_ +explained below. A simple implementation of a handler function might look +like this:: + + use Symfony\Component\VarDumper\VarDumper; + use Symfony\Component\VarDumper\Cloner\VarCloner; + use Symfony\Component\VarDumper\Dumper\CliDumper; + use Symfony\Component\VarDumper\Dumper\HtmlDumper; + + VarDumper::setHandler(function($var) { + $cloner = new VarCloner(); + $dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper(); + + $dumper->dump($cloner->cloneVar($var)); + }); Cloners -~~~~~~~ +------- A cloner is used to create an intermediate representation of any PHP variable. Its output is a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` @@ -21,18 +37,24 @@ object that wraps this representation. You can create a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object this way:: + use Symfony\Component\VarDumper\Cloner\VarCloner; + $cloner = new VarCloner(); $data = $cloner->cloneVar($myVar); + // this is commonly then passed to the dumpe + // see the example at the top of this page + // $dumper->dump($data); -A cloner also applies limits when creating this representation, so that the +A cloner also applies limits when creating the representation, so that the corresponding Data object could represent only a subset of the cloned variable. -Before :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::cloneVar`, +Before calling :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::cloneVar`, you can configure these limits: * :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::setMaxItems` - configures the maximum number of items that will be cloned *past the first - nesting level*. Items are counted using a breadth-first algorithm so that - lower level items have higher priority than deeply nested items; + configures the maximum number of items that will be cloned + *past the first nesting level*. Items are counted using a breadth-first + algorithm so that lower level items have higher priority than deeply nested + items; * :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::setMaxString` configures the maximum number of characters that will be cloned before cutting overlong strings; @@ -45,7 +67,7 @@ method: * the first ``$maxDepth`` argument allows limiting dumps in the depth dimension, * the second ``$maxItemsPerDepth`` limits the number of items per depth level, -* and the last ``$useRefHandles`` defaults to ``true`` but allows removing +* and the last ``$useRefHandles`` defaults to ``true``, but allows removing internal objects' handles for sparser output, * but unlike the previous limits on cloners that remove data on purpose, these can be changed back and forth before dumping since they do not affect @@ -54,11 +76,11 @@ method: .. note:: When no limit is applied, a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` - object is as accurate as the native :phpfunction:`serialize` function - and thus could have a wider purpose than strictly dumping for debugging. + object is as accurate as the native :phpfunction:`serialize` function, + and thus could be for purposes beyond dumping for debugging. Dumpers -~~~~~~~ +------- A dumper is responsible for outputting a string representation of a PHP variable, using a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object as input. @@ -70,6 +92,9 @@ for optionally colored command line output. For example, if you want to dump some ``$variable``, just do:: + use Symfony\Component\VarDumper\Cloner\VarCloner; + use Symfony\Component\VarDumper\Dumper\CliDumper; + $cloner = new VarCloner(); $dumper = new CliDumper(); @@ -77,7 +102,7 @@ For example, if you want to dump some ``$variable``, just do:: By using the first argument of the constructor, you can select the output stream where the dump will be written. By default, the ``CliDumper`` writes -on ``php://stdout`` and the ``HtmlDumper`` on ``php://output``, but any PHP +on ``php://stdout`` and the ``HtmlDumper`` on ``php://output``. But any PHP stream (resource or URL) is acceptable. Instead of a stream destination, you can also pass it a ``callable`` that @@ -90,6 +115,9 @@ method or the second argument of the For example, to get a dump as a string in a variable, you can do:: + use Symfony\Component\VarDumper\Cloner\VarCloner; + use Symfony\Component\VarDumper\Dumper\CliDumper; + $cloner = new VarCloner(); $dumper = new CliDumper(); $output = ''; @@ -107,7 +135,10 @@ For example, to get a dump as a string in a variable, you can do:: // $output is now populated with the dump representation of $variable -An other option for doing the same could be:: +Another option for doing the same could be:: + + use Symfony\Component\VarDumper\Cloner\VarCloner; + use Symfony\Component\VarDumper\Dumper\CliDumper; cloner = new VarCloner(); $dumper = new CliDumper(); @@ -128,9 +159,9 @@ them from re-implementing the logic required to walk through a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object's internal structure. Casters -~~~~~~~ +------- -Objects and resources nested in a PHP variable are casted to arrays in the +Objects and resources nested in a PHP variable are "cast" to arrays in the intermediate :class:`Symfony\\Component\\VarDumper\\Cloner\\Data` representation. You can tweak the array representation for each object/resource by hooking a Caster into this process. The component already includes many @@ -140,6 +171,8 @@ If you want to build your own Caster, you can register one before cloning a PHP variable. Casters are registered using either a Cloner's constructor or its ``addCasters()`` method:: + use Symfony\Component\VarDumper\Cloner\VarCloner; + $myCasters = array(...); $cloner = new VarCloner($myCasters); @@ -172,7 +205,7 @@ being cloned in an array. They are callables that accept four arguments: * an array modelled for objects after PHP's native ``(array)`` cast operator, * a :class:`Symfony\\Component\\VarDumper\\Cloner\\Stub` object representing the main properties of the object (class, type, etc.), -* true/false when the caster is called nested is a structure or not. +* true/false when the caster is called nested in a structure or not. Here is a simple caster not doing anything:: @@ -186,18 +219,18 @@ Here is a simple caster not doing anything:: For objects, the ``$array`` parameter comes pre-populated using PHP's native ``(array)`` casting operator or with the return value of ``$object->__debugInfo()`` if the magic method exists. Then, the return value of one Caster is given -as argument to the next Caster in the chain. +as the array argument to the next Caster in the chain. When casting with the ``(array)`` operator, PHP prefixes protected properties -with a ``\0*\0`` and private ones with the class owning the property: -e.g. ``\0Foobar\0`` prefixes all private properties of objects of type Foobar. -Casters follow this convention and add two more prefixes: ``\0~\0`` is used -for virtual properties and ``\0+\0`` for dynamic ones (runtime added +with a ``\0*\0`` and private ones with the class owning the property. For example, +``\0Foobar\0`` will be the prefix for all private properties of objects of +type Foobar. Casters follow this convention and add two more prefixes: ``\0~\0`` +is used for virtual properties and ``\0+\0`` for dynamic ones (runtime added properties not in the class declaration). .. note:: - Although you can, it is best advised not to alter the state of an object + Although you can, it is advised to not alter the state of an object while casting it in a Caster. .. tip:: diff --git a/components/var_dumper/introduction.rst b/components/var_dumper/introduction.rst index 6f43b67ef3d..aadfa6e2704 100644 --- a/components/var_dumper/introduction.rst +++ b/components/var_dumper/introduction.rst @@ -37,13 +37,21 @@ use instead of e.g. :phpfunction:`var_dump`. By using it, you'll gain: reference structure of your data; * Ability to operate in the context of an output buffering handler. +For example:: + + require __DIR__.'/vendor/autoload.php'; + // create a variable, which could be anything! + $someVar = '...'; + + dump($someVar); + By default, the output format and destination are selected based on your current PHP SAPI: * On the command line (CLI SAPI), the output is written on ``STDOUT``. This can be surprising to some because this bypasses PHP's output buffering mechanism; -* On other SAPIs, dumps are written as HTML on the regular output. +* On other SAPIs, dumps are written as HTML in the regular output. .. note:: @@ -101,8 +109,8 @@ original value. You can configure the limits in terms of: -Reading a Dump --------------- +Dump Examples and Output +------------------------ For simple variables, reading the output should be straightforward. Here are some examples showing first a variable defined in PHP, @@ -115,6 +123,7 @@ then its dump representation:: 'a boolean' => true, 'an empty array' => array(), ); + dump($var); .. image:: /images/components/var_dumper/01-simple.png @@ -131,6 +140,7 @@ then its dump representation:: $var .= "Non-UTF-8 strings length are counted in octet size.\n"; $var .= "Because of this `\xE9` octet (\\xE9),\n"; $var .= "this string is not UTF-8 valid, thus the `b` prefix.\n"; + dump($var); .. image:: /images/components/var_dumper/02-multi-line-str.png @@ -144,6 +154,7 @@ then its dump representation:: } $var = new PropertyExample(); + dump($var); .. image:: /images/components/var_dumper/03-object.png @@ -161,6 +172,7 @@ then its dump representation:: $var = new DynamicPropertyExample(); $var->undeclaredProperty = 'Runtime added dynamic properties have `"` around their name.'; + dump($var); .. image:: /images/components/var_dumper/04-dynamic-property.png @@ -172,12 +184,20 @@ then its dump representation:: } $var = new ReferenceExample(); $var->aCircularReference = $var; + dump($var); .. image:: /images/components/var_dumper/05-soft-ref.png .. code-block:: php - $var = new \ErrorException("For some objects, properties have special values\nthat are best represented as constants, like\n`severity` below. Hovering displays the value (`2`).\n", 0, E_WARNING); + $var = new \ErrorException( + "For some objects, properties have special values + that are best represented as constants, like + `severity` below. Hovering displays the value (`2`).", + 0, + E_WARNING + ); + dump($var); .. image:: /images/components/var_dumper/06-constants.png @@ -190,6 +210,7 @@ then its dump representation:: $var[2] = array("Hard references (circular or sibling)"); $var[3] =& $var[2]; $var[3][] = "are dumped using `&number` prefixes."; + dump($var); .. image:: /images/components/var_dumper/07-hard-ref.png @@ -199,12 +220,20 @@ then its dump representation:: $var[] = "Some resources and special objects like the current"; $var[] = "one are sometimes best represented using virtual"; $var[] = "properties that describe their internal state."; + dump($var); .. image:: /images/components/var_dumper/08-virtual-property.png .. code-block:: php - $var = new AcmeController("When a dump goes over its maximum items limit,\nor when some special objects are encountered,\nchildren can be replaced by an ellipsis and\noptionnally followed by a number that says how\nmany have been removed; `9` in this case.\n"); + $var = new AcmeController( + "When a dump goes over its maximum items limit, + or when some special objects are encountered, + children can be replaced by an ellipsis and + optionnally followed by a number that says how + many have been removed; `9` in this case." + ); + dump($var); .. image:: /images/components/var_dumper/09-cut.png From 09a6fd70b8fb4896ab5b8257997d38bc463772b6 Mon Sep 17 00:00:00 2001 From: Eric GELOEN Date: Sat, 18 Oct 2014 16:05:35 +0200 Subject: [PATCH 02/23] [Form] Add entity manager instance support for em option --- reference/forms/types/entity.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index dcada6d96eb..17728fa3be9 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -117,7 +117,7 @@ or the short alias name (as shown prior). em ~~ -**type**: ``string`` **default**: the default entity manager +**type**: ``string`` | ``Doctrine\Common\Persistence\ObjectManager`` **default**: the default entity manager If specified, the specified entity manager will be used to load the choices instead of the default entity manager. @@ -183,7 +183,7 @@ directly. choices ~~~~~~~ -**type**: array || ``\Traversable`` **default**: ``null`` +**type**: array | ``\Traversable`` **default**: ``null`` Instead of allowing the `class`_ and `query_builder`_ options to fetch the entities to include for you, you can pass the ``choices`` option directly. From 1a29f245b8cb2c35ac757274cc41b2348b137e00 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 8 Nov 2014 13:14:41 +0100 Subject: [PATCH 03/23] typos in the var-dumper component --- components/var_dumper/advanced.rst | 4 ++-- components/var_dumper/introduction.rst | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/var_dumper/advanced.rst b/components/var_dumper/advanced.rst index 6b6cbf4ebce..b6aae5c792e 100644 --- a/components/var_dumper/advanced.rst +++ b/components/var_dumper/advanced.rst @@ -12,7 +12,7 @@ You can change the behavior of this function by calling Calls to ``dump()`` will then be forwarded to ``$callable``. By adding a handler, you can customize the `Cloners`_, `Dumpers`_ and `Casters`_ -explained below. A simple implementation of a handler function might look +as explained below. A simple implementation of a handler function might look like this:: use Symfony\Component\VarDumper\VarDumper; @@ -41,7 +41,7 @@ object this way:: $cloner = new VarCloner(); $data = $cloner->cloneVar($myVar); - // this is commonly then passed to the dumpe + // this is commonly then passed to the dumper // see the example at the top of this page // $dumper->dump($data); diff --git a/components/var_dumper/introduction.rst b/components/var_dumper/introduction.rst index aadfa6e2704..990a4ad3b80 100644 --- a/components/var_dumper/introduction.rst +++ b/components/var_dumper/introduction.rst @@ -191,9 +191,9 @@ then its dump representation:: .. code-block:: php $var = new \ErrorException( - "For some objects, properties have special values - that are best represented as constants, like - `severity` below. Hovering displays the value (`2`).", + "For some objects, properties have special values\n" + ."that are best represented as constants, like\n" + ."`severity` below. Hovering displays the value (`2`).\n", 0, E_WARNING ); @@ -227,11 +227,11 @@ then its dump representation:: .. code-block:: php $var = new AcmeController( - "When a dump goes over its maximum items limit, - or when some special objects are encountered, - children can be replaced by an ellipsis and - optionnally followed by a number that says how - many have been removed; `9` in this case." + "When a dump goes over its maximum items limit,\n" + ."or when some special objects are encountered,\n" + ."children can be replaced by an ellipsis and\n" + ."optionnally followed by a number that says how\n" + ."many have been removed; `9` in this case.\n" ); dump($var); From bcab77b4c5769e6871eaf3cb8cc91a42d54dfcad Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 4 Jan 2015 12:07:10 +0100 Subject: [PATCH 04/23] bump Symfony requirements to PHP 5.5 --- book/controller.rst | 4 ++-- book/installation.rst | 18 ++---------------- book/security.rst | 2 -- book/translation.rst | 8 ++++---- .../http_foundation/session_configuration.rst | 17 ----------------- contributing/code/patches.rst | 2 +- cookbook/bundles/best_practices.rst | 9 ++++----- cookbook/deployment/azure-website.rst | 5 ++--- cookbook/logging/monolog.rst | 4 ++-- .../_ircmaxwell_password-compat.rst.inc | 13 ------------- cookbook/security/entity_provider.rst | 2 -- cookbook/web_server/built_in.rst | 9 ++++----- quick_tour/the_big_picture.rst | 4 ++-- reference/configuration/framework.rst | 3 +-- reference/requirements.rst | 10 +--------- 15 files changed, 25 insertions(+), 85 deletions(-) delete mode 100644 cookbook/security/_ircmaxwell_password-compat.rst.inc diff --git a/book/controller.rst b/book/controller.rst index aa4ffb873e6..94ec262ff7b 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -116,7 +116,7 @@ Controllers are also called *actions*. This controller is pretty straightforward: -* *line 4*: Symfony takes advantage of PHP 5.3 namespace functionality to +* *line 4*: Symfony takes advantage of PHP's namespace functionality to namespace the entire controller class. The ``use`` keyword imports the ``Response`` class, which the controller must return. @@ -559,7 +559,7 @@ Symfony will automatically return a 500 HTTP response code. throw new \Exception('Something went wrong!'); In every case, an error page is shown to the end user and a full debug -error page is shown to the developer (i.e. when you're using ``app_dev.php`` - +error page is shown to the developer (i.e. when you're using ``app_dev.php`` - see :ref:`page-creation-environments`). You'll want to customize the error page your user sees. To do that, see the diff --git a/book/installation.rst b/book/installation.rst index e270eb87815..95bb41105b5 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -16,13 +16,6 @@ Using the Symfony Installer is the only recommended way to create new Symfony applications. This installer is a PHP application that has to be installed only once and then it can create any number of Symfony applications. -.. note:: - - The installer requires PHP 5.4 or higher. If you still use the legacy - PHP 5.3 version, you cannot use the Symfony Installer. Read the - :ref:`book-creating-applications-without-the-installer` section to learn how - to proceed. - Depending on your operating system, the installer must be installed in different ways. @@ -107,9 +100,8 @@ to use for your projects. Creating Symfony Applications without the Installer --------------------------------------------------- -If you still use PHP 5.3, or if you can't execute the installer for any reason, -you can create Symfony applications using the alternative installation method -based on `Composer`_. +If you can't execute the installer for any reason, you can create Symfony +applications using the alternative installation method based on `Composer`_. Composer is the dependency manager used by modern PHP applications and it can also be used to create new applications based on the Symfony framework. If you @@ -168,12 +160,6 @@ possible solutions depending on your operating system. All of them are explained in the :ref:`Setting up Permissions ` section. -.. note:: - - PHP's internal web server is available in PHP 5.4 or higher versions. If you - still use the legacy PHP 5.3 version, you'll have to configure a *virtual host* - in your web server. - The ``server:run`` command is only suitable while developing the application. In order to run Symfony applications on production servers, you'll have to configure your `Apache`_ or `Nginx`_ web server as explained in diff --git a/book/security.rst b/book/security.rst index c9740cf71b2..6b1851fe457 100644 --- a/book/security.rst +++ b/book/security.rst @@ -486,8 +486,6 @@ else, you'll want to encode their passwords. The best algorithm to use is // ... )); -.. include:: /cookbook/security/_ircmaxwell_password-compat.rst.inc - Of course, your user's passwords now need to be encoded with this exact algorithm. For hardcoded users, you can use an `online tool`_, which will give you something like this: diff --git a/book/translation.rst b/book/translation.rst index a847344b90d..bff9016bb3e 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -405,8 +405,8 @@ checks translation resources for several locales: .. note:: - When Symfony doesn't find a translation in the given locale, it will - add the missing translation to the log file. For details, + When Symfony doesn't find a translation in the given locale, it will + add the missing translation to the log file. For details, see :ref:`reference-framework-translator-logging`. .. _book-translation-user-locale: @@ -664,8 +664,8 @@ Translating Database Content ---------------------------- The translation of database content should be handled by Doctrine through -the `Translatable Extension`_ or the `Translatable Behavior`_ (PHP 5.4+). -For more information, see the documentation for these libraries. +the `Translatable Extension`_ or the `Translatable Behavior`_. For more information, +see the documentation for these libraries. Debugging Translations ---------------------- diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index c2608110621..f6b412e488e 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -218,23 +218,6 @@ particular cookie by reading the ``getLifetime()`` method:: The expiry time of the cookie can be determined by adding the created timestamp and the lifetime. -PHP 5.4 Compatibility -~~~~~~~~~~~~~~~~~~~~~ - -Since PHP 5.4.0, :phpclass:`SessionHandler` and :phpclass:`SessionHandlerInterface` -are available. Symfony provides forward compatibility for the :phpclass:`SessionHandlerInterface` -so it can be used under PHP 5.3. This greatly improves interoperability with other -libraries. - -:phpclass:`SessionHandler` is a special PHP internal class which exposes native save -handlers to PHP user-space. - -In order to provide a solution for those using PHP 5.4, Symfony has a special -class called :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler` -which under PHP 5.4, extends from ``\SessionHandler`` and under PHP 5.3 is just a -empty base class. This provides some interesting opportunities to leverage -PHP 5.4 functionality if it is available. - Save Handler Proxy ~~~~~~~~~~~~~~~~~~ diff --git a/contributing/code/patches.rst b/contributing/code/patches.rst index 1f9bf7000e5..13581d1d8eb 100644 --- a/contributing/code/patches.rst +++ b/contributing/code/patches.rst @@ -14,7 +14,7 @@ Before working on Symfony, setup a friendly environment with the following software: * Git; -* PHP version 5.3.3 or above; +* PHP version 5.5.9 or above; * `PHPUnit`_ 4.2 or above. Configure Git diff --git a/cookbook/bundles/best_practices.rst b/cookbook/bundles/best_practices.rst index 30519f52888..5beb13fd741 100644 --- a/cookbook/bundles/best_practices.rst +++ b/cookbook/bundles/best_practices.rst @@ -29,10 +29,9 @@ Bundle Name ----------- A bundle is also a PHP namespace. The namespace must follow the technical -interoperability `standards`_ for PHP 5.3 namespaces and class names: it -starts with a vendor segment, followed by zero or more category segments, and -it ends with the namespace short name, which must end with a ``Bundle`` -suffix. +interoperability `standards`_ for PHP namespaces and class names: it starts +with a vendor segment, followed by zero or more category segments, and it +ends with the namespace short name, which must end with a ``Bundle`` suffix. A namespace becomes a bundle as soon as you add a bundle class to it. The bundle class name must follow these simple rules: @@ -348,7 +347,7 @@ there are 3 modes, which the user can configure in their project: * 2.4: the original 2.4 and earlier validation API; * 2.5: the new 2.5 and later validation API; * 2.5-BC: the new 2.5 API with a backwards-compatible layer so that the - 2.4 API still works. This is only available in PHP 5.3.9+. + 2.4 API still works. As a bundle author, you'll want to support *both* API's, since some users may still be using the 2.4 API. Specifically, if your bundle adds a violation diff --git a/cookbook/deployment/azure-website.rst b/cookbook/deployment/azure-website.rst index efee282260e..36d61f26bb7 100644 --- a/cookbook/deployment/azure-website.rst +++ b/cookbook/deployment/azure-website.rst @@ -96,9 +96,8 @@ and how to properly configure PHP for a production environment. Configuring the latest PHP Runtime ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Even though Symfony only requires PHP 5.3.3 to run, it's always recommended -to use the most recent PHP version whenever possible. PHP 5.3 is no longer -supported by the PHP core team, but you can update it easily in Azure. +Even though Symfony only requires PHP 5.5.9 to run, it's always recommended +to use the most recent PHP version whenever possible. To update your PHP version on Azure, go to the **Configure** tab of the control panel and select the version you want. diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index ab290e5d519..2909146fc48 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -4,8 +4,8 @@ How to Use Monolog to Write Logs ================================ -Monolog_ is a logging library for PHP 5.3 used by Symfony. It is -inspired by the Python LogBook library. +Monolog_ is a logging library for PHP used by Symfony. It is inspired by the +Python LogBook library. Usage ----- diff --git a/cookbook/security/_ircmaxwell_password-compat.rst.inc b/cookbook/security/_ircmaxwell_password-compat.rst.inc deleted file mode 100644 index 3f96c454488..00000000000 --- a/cookbook/security/_ircmaxwell_password-compat.rst.inc +++ /dev/null @@ -1,13 +0,0 @@ -.. caution:: - - If you're using PHP 5.4 or lower, you'll need to install the ``ircmaxell/password-compat`` - library via Composer in order to be able to use the ``bcrypt`` encoder: - - .. code-block:: json - - { - "require": { - ... - "ircmaxell/password-compat": "~1.0.3" - } - } diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 398138398ce..97b19c2e8b6 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -355,8 +355,6 @@ the database to be encoded using this encoder. For details on how to create a new User object with a properly encoded password, see the :ref:`book-security-encoding-user-password` section of the security chapter. -.. include:: /cookbook/security/_ircmaxwell_password-compat.rst.inc - The ``providers`` section defines an ``administrators`` user provider. A user provider is a "source" of where users are loaded during authentication. In this case, the ``entity`` keyword means that Symfony will use the Doctrine diff --git a/cookbook/web_server/built_in.rst b/cookbook/web_server/built_in.rst index 33289907614..c9293749f99 100644 --- a/cookbook/web_server/built_in.rst +++ b/cookbook/web_server/built_in.rst @@ -8,11 +8,10 @@ How to Use PHP's built-in Web Server The ability to run the server as a background process was introduced in Symfony 2.6. -Since PHP 5.4 the CLI SAPI comes with a `built-in web server`_. It can be used -to run your PHP applications locally during development, for testing or for -application demonstrations. This way, you don't have to bother configuring -a full-featured web server such as -:doc:`Apache or Nginx `. +The CLI SAPI comes with a `built-in web server`_. It can be used to run your +PHP applications locally during development, for testing or for application +demonstrations. This way, you don't have to bother configuring a full-featured +web server such as :doc:`Apache or Nginx `. .. caution:: diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 1dd9e8fa48a..1882e39ec5e 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -8,9 +8,9 @@ by showing you a simple project in action. If you've used a web framework before, you should feel right at home with Symfony. If not, welcome to a whole new way of developing web applications. -The only technical requisite to follow this tutorial is to have **PHP 5.4 or higher +The only technical requisite to follow this tutorial is to have **PHP 5.5.9 or higher installed on your computer**. If you use a packaged PHP solution such as WAMP, -XAMP or MAMP, check out that they are using PHP 5.4 or a more recent version. +XAMP or MAMP, check out that they are using PHP 5.5.9 or a more recent version. You can also execute the following command in your terminal or command console to display the installed PHP version: diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 5c2d3bc2547..1f9c413d20f 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -641,8 +641,7 @@ API. The ``api`` option is used to switch between the different implementations: ``2.5-bc`` or ``auto`` If you omit a value or set the ``api`` option to ``2.5-bc`` or ``auto``, Symfony will use an API implementation that is compatible with both the - legacy implementation and the ``2.5`` implementation. You have to use - PHP 5.3.9 or higher to be able to use this implementation. + legacy implementation and the ``2.5`` implementation. Full default Configuration -------------------------- diff --git a/reference/requirements.rst b/reference/requirements.rst index 5edc791f788..12c24d65e7a 100644 --- a/reference/requirements.rst +++ b/reference/requirements.rst @@ -21,17 +21,11 @@ Below is the list of required and optional requirements. Required -------- -* PHP needs to be a minimum version of PHP 5.3.3 +* PHP needs to be a minimum version of PHP 5.5.9 * JSON needs to be enabled * ctype needs to be enabled * Your ``php.ini`` needs to have the ``date.timezone`` setting -.. caution:: - - Be aware that Symfony has some known limitations when using a PHP version - less than 5.3.8 or equal to 5.3.16. For more information see the - `Requirements section of the README`_. - Optional -------- @@ -56,5 +50,3 @@ Doctrine If you want to use Doctrine, you will need to have PDO installed. Additionally, you need to have the PDO driver installed for the database server you want to use. - -.. _`Requirements section of the README`: https://github.com/symfony/symfony#requirements From d33b78b2f60b08da7d290577c41378c97dadd1df Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 4 Jan 2015 12:39:58 +0100 Subject: [PATCH 05/23] don't describe removed usage of Yaml::parse() --- components/yaml/introduction.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index e7e92270493..4ad0f833274 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -138,12 +138,6 @@ string or a file containing YAML. Internally, it calls the :method:`Symfony\\Component\\Yaml\\Parser::parse` method, but enhances the error if something goes wrong by adding the filename to the message. -.. caution:: - - Because it is currently possible to pass a filename to this method, you - must validate the input first. Passing a filename is deprecated in - Symfony 2.2, and will be removed in Symfony 3.0. - .. _components-yaml-dump: Writing YAML Files From 7d2f0f3cbdb753cf19c44db53883cdb27a4cf8f7 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 4 Jan 2015 19:10:37 +0100 Subject: [PATCH 06/23] Removed 2.5 versionadded as its deprecated --- book/security.rst | 8 -------- book/templating.rst | 6 ------ book/translation.rst | 3 --- book/validation.rst | 3 --- components/class_loader/psr4_class_loader.rst | 4 ---- components/console/changing_default_command.rst | 4 ---- components/console/helpers/progressbar.rst | 4 ---- components/console/helpers/questionhelper.rst | 3 --- components/console/helpers/table.rst | 4 ---- components/console/logger.rst | 4 ---- components/dependency_injection/advanced.rst | 3 --- components/event_dispatcher/traceable_dispatcher.rst | 4 ---- components/form/introduction.rst | 8 -------- components/process.rst | 8 -------- components/property_access/introduction.rst | 7 ------- components/serializer.rst | 5 ----- components/stopwatch.rst | 3 --- components/templating/helpers/assetshelper.rst | 6 ------ cookbook/console/console_command.rst | 10 ---------- cookbook/request/mime_type.rst | 3 --- cookbook/security/acl_advanced.rst | 7 ------- cookbook/security/firewall_restriction.rst | 4 ---- cookbook/security/named_encoders.rst | 3 --- cookbook/validation/custom_constraint.rst | 5 ----- reference/configuration/security.rst | 4 ---- reference/constraints/Callback.rst | 5 ----- reference/constraints/Email.rst | 3 --- reference/constraints/Uuid.rst | 3 --- reference/forms/types/collection.rst | 3 --- reference/forms/types/file.rst | 3 --- 30 files changed, 140 deletions(-) diff --git a/book/security.rst b/book/security.rst index 6942b426965..b59849a1268 100644 --- a/book/security.rst +++ b/book/security.rst @@ -809,9 +809,6 @@ You can easily deny access from inside a controller:: The ``security.authorization_checker`` service was introduced in Symfony 2.6. Prior to Symfony 2.6, you had to use the ``isGranted()`` method of the ``security.context`` service. -.. versionadded:: 2.5 - The ``createAccessDeniedException`` method was introduced in Symfony 2.5. - The :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::createAccessDeniedException` method creates a special :class:`Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException` object, which ultimately triggers a 403 HTTP response inside Symfony. @@ -1306,11 +1303,6 @@ cookie will be ever created by Symfony): Checking for Known Security Vulnerabilities in Dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 2.5 - The ``security:check`` command was introduced in Symfony 2.5. This command is - included in ``SensioDistributionBundle``, which has to be registered in your - application in order to use this command. - When using lots of dependencies in your Symfony projects, some of them may contain security vulnerabilities. That's why Symfony includes a command called ``security:check`` that checks your ``composer.lock`` file to find any known diff --git a/book/templating.rst b/book/templating.rst index 35d477c0ed3..03aa4f8dbe6 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1021,9 +1021,6 @@ configuration option. .. _`book-templating-version-by-asset`: -.. versionadded:: 2.5 - Setting versioned URLs on an asset-by-asset basis was introduced in Symfony 2.5. - If you need to set a version for a specific asset, you can set the fourth argument (or the ``version`` argument) to the desired version: @@ -1041,9 +1038,6 @@ If you dont give a version or pass ``null``, the default package version (from :ref:`ref-framework-assets-version`) will be used. If you pass ``false``, versioned URL will be deactivated for this asset. -.. versionadded:: 2.5 - Absolute URLs for assets were introduced in Symfony 2.5. - If you need absolute URLs for assets, you can set the third argument (or the ``absolute`` argument) to ``true``: diff --git a/book/translation.rst b/book/translation.rst index a847344b90d..9fc8e28d060 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -670,9 +670,6 @@ For more information, see the documentation for these libraries. Debugging Translations ---------------------- -.. versionadded:: 2.5 - The ``debug:translation`` command was introduced in Symfony 2.5. - .. versionadded:: 2.6 Prior to Symfony 2.6, this command was called ``translation:debug``. diff --git a/book/validation.rst b/book/validation.rst index 08726dc89ed..c7d2e0942c4 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -586,9 +586,6 @@ allows you to add a constraint to any public method whose name starts with "get", "is" or "has". In this guide, these types of methods are referred to as "getters". -.. versionadded:: 2.5 - Support for methods starting with ``has`` was introduced in Symfony 2.5. - The benefit of this technique is that it allows you to validate your object dynamically. For example, suppose you want to make sure that a password field doesn't match the first name of the user (for security reasons). You can diff --git a/components/class_loader/psr4_class_loader.rst b/components/class_loader/psr4_class_loader.rst index e388590310d..986354c2139 100644 --- a/components/class_loader/psr4_class_loader.rst +++ b/components/class_loader/psr4_class_loader.rst @@ -4,10 +4,6 @@ The PSR-4 Class Loader ====================== -.. versionadded:: 2.5 - The :class:`Symfony\\Component\\ClassLoader\\Psr4ClassLoader` was - introduced in Symfony 2.5. - Libraries that follow the `PSR-4`_ standard can be loaded with the ``Psr4ClassLoader``. .. note:: diff --git a/components/console/changing_default_command.rst b/components/console/changing_default_command.rst index 757a0c9f88c..7f8f50bda48 100644 --- a/components/console/changing_default_command.rst +++ b/components/console/changing_default_command.rst @@ -4,10 +4,6 @@ Changing the Default Command ============================ -.. versionadded:: 2.5 - The :method:`Symfony\\Component\\Console\\Application::setDefaultCommand` - method was introduced in Symfony 2.5. - The Console component will always run the ``ListCommand`` when no command name is passed. In order to change the default command you just need to pass the command name to the ``setDefaultCommand`` method:: diff --git a/components/console/helpers/progressbar.rst b/components/console/helpers/progressbar.rst index 1b8edf309cc..915efa8f158 100644 --- a/components/console/helpers/progressbar.rst +++ b/components/console/helpers/progressbar.rst @@ -4,10 +4,6 @@ Progress Bar ============ -.. versionadded:: 2.5 - The Progress Bar feature was introduced in Symfony 2.5 as a replacement for - the :doc:`Progress Helper `. - When executing longer-running commands, it may be helpful to show progress information, which updates as your command runs: diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 6a745c09609..8ad2d861654 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -4,9 +4,6 @@ Question Helper =============== -.. versionadded:: 2.5 - The Question Helper was introduced in Symfony 2.5. - The :class:`Symfony\\Component\\Console\\Helper\\QuestionHelper` provides functions to ask the user for more information. It is included in the default helper set, which you can get by calling diff --git a/components/console/helpers/table.rst b/components/console/helpers/table.rst index 0f3511fe040..f8e4591d99b 100644 --- a/components/console/helpers/table.rst +++ b/components/console/helpers/table.rst @@ -4,10 +4,6 @@ Table ===== -.. versionadded:: 2.5 - The ``Table`` class was introduced in Symfony 2.5 as a replacement for the - :doc:`Table Helper `. - When building a console application it may be useful to display tabular data: .. code-block:: text diff --git a/components/console/logger.rst b/components/console/logger.rst index 43951c63130..3f9d9036765 100644 --- a/components/console/logger.rst +++ b/components/console/logger.rst @@ -4,10 +4,6 @@ Using the Logger ================ -.. versionadded:: 2.5 - The :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger` was - introduced in Symfony 2.5. - The Console component comes with a standalone logger complying with the `PSR-3`_ standard. Depending on the verbosity setting, log messages will be sent to the :class:`Symfony\\Component\\Console\\Output\\OutputInterface` diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index babd7cfd0fc..425c419ec35 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -225,9 +225,6 @@ which means that your file will be included only once per request. Decorating Services ------------------- -.. versionadded:: 2.5 - Decorated services were introduced in Symfony 2.5. - When overriding an existing definition, the old service is lost: .. code-block:: php diff --git a/components/event_dispatcher/traceable_dispatcher.rst b/components/event_dispatcher/traceable_dispatcher.rst index 3c1bcc2118c..4bfb1fd2974 100644 --- a/components/event_dispatcher/traceable_dispatcher.rst +++ b/components/event_dispatcher/traceable_dispatcher.rst @@ -5,10 +5,6 @@ The Traceable Event Dispatcher ============================== -.. versionadded:: 2.5 - The ``TraceableEventDispatcher`` class was moved to the EventDispatcher - component in Symfony 2.5. Before, it was located in the HttpKernel component. - The :class:`Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher` is an event dispatcher that wraps any other event dispatcher and can then be used to determine which event listeners have been called by the dispatcher. diff --git a/components/form/introduction.rst b/components/form/introduction.rst index 09c947429b5..e0b2e01d7be 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -663,14 +663,6 @@ and the errors will display next to the fields on error. Accessing Form Errors ~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 2.5 - Before Symfony 2.5, ``getErrors()`` returned an array of ``FormError`` - objects. The return value was changed to ``FormErrorIterator`` in Symfony - 2.5. - -.. versionadded:: 2.5 - The ``$deep`` and ``$flatten`` arguments were introduced in Symfony 2.5. - You can use the :method:`Symfony\\Component\\Form\\FormInterface::getErrors` method to access the list of errors. It returns a :class:`Symfony\\Component\\Form\\FormErrorIterator` instance:: diff --git a/components/process.rst b/components/process.rst index ef77f6078da..19d04356beb 100644 --- a/components/process.rst +++ b/components/process.rst @@ -50,9 +50,6 @@ the contents of the output and :method:`Symfony\\Component\\Process\\Process::clearErrorOutput` clears the contents of the error output. -.. versionadded:: 2.5 - The ``mustRun()`` method was introduced in Symfony 2.5. - The ``mustRun()`` method is identical to ``run()``, except that it will throw a :class:`Symfony\\Component\\Process\\Exception\\ProcessFailedException` if the process couldn't be executed successfully (i.e. the process exited @@ -306,11 +303,6 @@ You can access the `pid`_ of a running process with the Disabling Output ---------------- -.. versionadded:: 2.5 - The :method:`Symfony\\Component\\Process\\Process::disableOutput` and - :method:`Symfony\\Component\\Process\\Process::enableOutput` methods were - introduced in Symfony 2.5. - As standard output and error output are always fetched from the underlying process, it might be convenient to disable output in some cases to save memory. Use :method:`Symfony\\Component\\Process\\Process::disableOutput` and diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index d8d4c774610..1ab83d19d0e 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -314,13 +314,6 @@ see `Enable other Features`_. Checking Property Paths ----------------------- -.. versionadded:: 2.5 - The - :method:`PropertyAccessor::isReadable ` - and - :method:`PropertyAccessor::isWritable ` - methods were introduced in Symfony 2.5. - When you want to check whether :method:`PropertyAccessor::getValue` can safely be called without actually calling that method, you can use diff --git a/components/serializer.rst b/components/serializer.rst index ac40aa46a19..15fef1c867e 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -198,11 +198,6 @@ it were ``firstName`` and uses the ``getFirstName`` and ``setFirstName`` methods Serializing Boolean Attributes ------------------------------ -.. versionadded:: 2.5 - Support for ``is*`` accessors in - :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer` - was introduced in Symfony 2.5. - If you are using isser methods (methods prefixed by ``is``, like ``Acme\Person::isSportsman()``), the Serializer component will automatically detect and use it to serialize related attributes. diff --git a/components/stopwatch.rst b/components/stopwatch.rst index 58c76b85cff..fccd56675a7 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -31,9 +31,6 @@ microtime by yourself. Instead, use the simple // ... some code goes here $event = $stopwatch->stop('eventName'); -.. versionadded:: 2.5 - The ``getEvent()`` method was introduced in Symfony 2.5 - The :class:`Symfony\\Component\\Stopwatch\\StopwatchEvent` object can be retrieved from the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::start`, :method:`Symfony\\Component\\Stopwatch\\Stopwatch::stop`, diff --git a/components/templating/helpers/assetshelper.rst b/components/templating/helpers/assetshelper.rst index 73f8042aaab..e4f30ef915d 100644 --- a/components/templating/helpers/assetshelper.rst +++ b/components/templating/helpers/assetshelper.rst @@ -47,9 +47,6 @@ You can also specify a URL to use in the second parameter of the constructor:: Now URLs are rendered like ``http://cdn.example.com/images/logo.png``. -.. versionadded:: 2.5 - Absolute URLs for assets were introduced in Symfony 2.5. - You can also use the third argument of the helper to force an absolute URL: .. code-block:: html+php @@ -80,9 +77,6 @@ is used in :phpfunction:`sprintf`. The first argument is the path and the second is the version. For instance, ``%s?v=%s`` will be rendered as ``/images/logo.png?v=328rad75``. -.. versionadded:: 2.5 - On-demand versioned URLs for assets were introduced in Symfony 2.5. - You can also generate a versioned URL on an asset-by-asset basis using the fourth argument of the helper: diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index b71b0792781..83f8c53ec99 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -225,13 +225,3 @@ you can extend your test from // ... } } - -.. versionadded:: 2.5 - :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase` was - extracted from :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase` - in Symfony 2.5. ``WebTestCase`` inherits from ``KernelTestCase``. The - ``WebTestCase`` creates an instance of - :class:`Symfony\\Bundle\\FrameworkBundle\\Client` via ``createClient()``, - while ``KernelTestCase`` creates an instance of - :class:`Symfony\\Component\\HttpKernel\\KernelInterface` via - ``createKernel()``. diff --git a/cookbook/request/mime_type.rst b/cookbook/request/mime_type.rst index adee071daed..269156654c3 100644 --- a/cookbook/request/mime_type.rst +++ b/cookbook/request/mime_type.rst @@ -15,9 +15,6 @@ object. Internally, Symfony contains a map of the most common formats (e.g. easily be added. This document will show how you can add the ``jsonp`` format and corresponding MIME type. -.. versionadded:: 2.5 - The possibility to configure request formats was introduced in Symfony 2.5. - Configure your New Format ------------------------- diff --git a/cookbook/security/acl_advanced.rst b/cookbook/security/acl_advanced.rst index 4d11081f4e5..d4f18265d82 100644 --- a/cookbook/security/acl_advanced.rst +++ b/cookbook/security/acl_advanced.rst @@ -45,13 +45,6 @@ Security Identities This is analog to the object identity, but represents a user, or a role in your application. Each role, or user has its own security identity. -.. versionadded:: 2.5 - For users, the security identity is based on the username. This means that, - if for any reason, a user's username was to change, you must ensure its - security identity is updated too. The - :method:`MutableAclProvider::updateUserSecurityIdentity() ` - method is there to handle the update, it was introduced in Symfony 2.5. - Database Table Structure ------------------------ diff --git a/cookbook/security/firewall_restriction.rst b/cookbook/security/firewall_restriction.rst index 24d77c4df4c..227eac10420 100644 --- a/cookbook/security/firewall_restriction.rst +++ b/cookbook/security/firewall_restriction.rst @@ -135,10 +135,6 @@ request. Restricting by HTTP Methods --------------------------- -.. versionadded:: 2.5 - Support for restricting security firewalls to specific HTTP methods was introduced in - Symfony 2.5. - The configuration option ``methods`` restricts the initialization of the firewall to the provided HTTP methods. diff --git a/cookbook/security/named_encoders.rst b/cookbook/security/named_encoders.rst index 3b22a2d9343..0cdd0b2eb7b 100644 --- a/cookbook/security/named_encoders.rst +++ b/cookbook/security/named_encoders.rst @@ -4,9 +4,6 @@ How to Choose the Password Encoder Algorithm Dynamically ======================================================== -.. versionadded:: 2.5 - Named encoders were introduced in Symfony 2.5. - Usually, the same password encoder is used for all users by configuring it to apply to all instances of a specific class: diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index d6f9f4a3f9a..9ef114bf358 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -88,11 +88,6 @@ message as its argument and returns an instance of :class:`Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilderInterface`. The ``addViolation`` method call finally adds the violation to the context. -.. versionadded:: 2.5 - The ``buildViolation`` method was added in Symfony 2.5. For usage examples - with older Symfony versions, see the corresponding versions of this documentation - page. - Using the new Validator ----------------------- diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 3a2af3c3a05..5817b507e20 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -17,10 +17,6 @@ Each part will be explained in the next section. Support for restricting security firewalls to a specific host was introduced in Symfony 2.4. -.. versionadded:: 2.5 - Support for restricting security firewalls to specific http methods was introduced in - Symfony 2.5. - .. configuration-block:: .. code-block:: yaml diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index e0a21e4b2e0..a4757ac1c76 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -134,11 +134,6 @@ those errors should be attributed:: } } -.. versionadded:: 2.5 - The ``buildViolation`` method was added in Symfony 2.5. For usage examples - with older Symfony versions, see the corresponding versions of this documentation - page. - Static Callbacks ---------------- diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 9df3332a749..2a5b9ea2e6b 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -90,9 +90,6 @@ Basic Usage Options ------- -.. versionadded:: 2.5 - The ``strict`` option was introduced in Symfony 2.5. - strict ~~~~~~ diff --git a/reference/constraints/Uuid.rst b/reference/constraints/Uuid.rst index 4db4fc8ceab..ece78165716 100644 --- a/reference/constraints/Uuid.rst +++ b/reference/constraints/Uuid.rst @@ -1,9 +1,6 @@ Uuid ==== -.. versionadded:: 2.5 - The Uuid constraint was introduced in Symfony 2.5. - Validates that a value is a valid `Universally unique identifier (UUID)`_ per `RFC 4122`_. By default, this will validate the format according to the RFC's guidelines, but this can be relaxed to accept non-standard UUIDs that other systems (like PostgreSQL) accept. diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index 2d21cf57a3a..367abb2eda1 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -259,9 +259,6 @@ For more information, see :ref:`cookbook-form-collections-remove`. delete_empty ~~~~~~~~~~~~ -.. versionadded:: 2.5 - The ``delete_empty`` option was introduced in Symfony 2.5. - **type**: ``Boolean`` **default**: ``false`` If you want to explicitly remove entirely empty collection entries from your diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst index 2449a4fdc92..d8f4228ee37 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -86,9 +86,6 @@ Field Options multiple ~~~~~~~~ -.. versionadded:: 2.5 - The ``multiple`` option was introduced in Symfony 2.5. - **type**: ``Boolean`` **default**: ``false`` When set to true, the user will be able to upload multiple files at the same time. From c859790e1a86015a7d7d6505ca9ed311e98d608a Mon Sep 17 00:00:00 2001 From: Wouter J Date: Fri, 9 Jan 2015 01:58:37 +0100 Subject: [PATCH 07/23] Fixed markup --- components/options_resolver.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index ef9a0f18bd2..16054e3cade 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -361,10 +361,9 @@ In sub-classes, you can use :method:`Symfony\\Component\\OptionsResolver\\Option to add additional allowed types without erasing the ones already set. .. versionadded:: 2.6 - Before Symfony 2.6, `setAllowedTypes()` and `addAllowedTypes()` expected - the values to be given as an array mapping option names to allowed types:: - - $resolver->setAllowedTypes(array('port' => array('null', 'int'))); + Before Symfony 2.6, ``setAllowedTypes()`` and ``addAllowedTypes()`` expected + the values to be given as an array mapping option names to allowed types: + ``$resolver->setAllowedTypes(array('port' => array('null', 'int')));`` Value Validation ~~~~~~~~~~~~~~~~ From 9919bcaa44a2f55b97036a54356eea12cb5ec7a8 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 9 Jan 2015 01:59:31 +0100 Subject: [PATCH 08/23] Revert "Fixed markup" This reverts commit c859790e1a86015a7d7d6505ca9ed311e98d608a. --- components/options_resolver.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index 16054e3cade..ef9a0f18bd2 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -361,9 +361,10 @@ In sub-classes, you can use :method:`Symfony\\Component\\OptionsResolver\\Option to add additional allowed types without erasing the ones already set. .. versionadded:: 2.6 - Before Symfony 2.6, ``setAllowedTypes()`` and ``addAllowedTypes()`` expected - the values to be given as an array mapping option names to allowed types: - ``$resolver->setAllowedTypes(array('port' => array('null', 'int')));`` + Before Symfony 2.6, `setAllowedTypes()` and `addAllowedTypes()` expected + the values to be given as an array mapping option names to allowed types:: + + $resolver->setAllowedTypes(array('port' => array('null', 'int'))); Value Validation ~~~~~~~~~~~~~~~~ From 050f7cee42458b64ab0be20472302c6105ac9379 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 18 Jan 2015 23:19:49 +0100 Subject: [PATCH 09/23] Documented true regex --- components/console/helpers/questionhelper.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 8ad2d861654..bf30da8cf27 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -41,6 +41,24 @@ The second argument to is the default value to return if the user doesn't enter any input. Any other input will ask the same question again. +.. tip:: + + You can customize the regex used to check if the answer means "yes" in the + third argument of the constructor. For instance, to allow anything that + starts with either ``y`` or ``j``, you would set it to:: + + $question = new ConfirmationQuestion( + 'Continue with this action?', + false, + '/^(y|j)/i' + ); + + The regex defaults to ``/^y/i``. + + .. versionadded:: 2.7 + The regex argument was introduced in Symfony 2.7, before only answers + starting with ``y`` were considered as yes. + Asking the User for Information ------------------------------- From 728205f8b85e3537c326152f74fbd4fd93a79c9a Mon Sep 17 00:00:00 2001 From: Peter Rehm Date: Tue, 6 Jan 2015 19:37:14 +0100 Subject: [PATCH 10/23] Replaced setDefaultOptions by the new configureOptions method --- best_practices/forms.rst | 4 +-- book/forms.rst | 34 +++++++++---------- cookbook/doctrine/registration_form.rst | 4 +-- cookbook/form/create_custom_field_type.rst | 10 +++--- cookbook/form/create_form_type_extension.rst | 8 ++--- cookbook/form/data_transformers.rst | 9 ++--- cookbook/form/dynamic_form_modification.rst | 9 ++--- cookbook/form/form_collections.rst | 8 ++--- cookbook/form/inherit_data_option.rst | 4 +-- cookbook/form/use_empty_data.rst | 8 ++--- reference/dic_tags.rst | 2 +- .../forms/types/options/error_mapping.rst.inc | 2 +- 12 files changed, 49 insertions(+), 53 deletions(-) diff --git a/best_practices/forms.rst b/best_practices/forms.rst index d72d189ccfb..3655c298750 100644 --- a/best_practices/forms.rst +++ b/best_practices/forms.rst @@ -21,7 +21,7 @@ form in its own PHP class:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class PostType extends AbstractType { @@ -36,7 +36,7 @@ form in its own PHP class:: ; } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Post' diff --git a/book/forms.rst b/book/forms.rst index 57a1763f05b..f65d044b164 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -471,12 +471,12 @@ you'll need to specify which validation group(s) your form should use:: ))->add(...); If you're creating :ref:`form classes ` (a -good practice), then you'll need to add the following to the ``setDefaultOptions()`` +good practice), then you'll need to add the following to the ``configureOptions()`` method:: - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'validation_groups' => array('registration'), @@ -498,9 +498,9 @@ Disabling Validation Sometimes it is useful to suppress the validation of a form altogether. For these cases you can set the ``validation_groups`` option to ``false``:: - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'validation_groups' => false, @@ -524,10 +524,10 @@ If you need some advanced logic to determine the validation groups (e.g. based on submitted data), you can set the ``validation_groups`` option to an array callback:: - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; // ... - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'validation_groups' => array( @@ -544,10 +544,10 @@ You can also define whole logic inline by using a ``Closure``:: use Acme\AcmeBundle\Entity\Client; use Symfony\Component\Form\FormInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; // ... - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'validation_groups' => function(FormInterface $form) { @@ -567,10 +567,10 @@ of the entity as well you have to adjust the option as follows:: use Acme\AcmeBundle\Entity\Client; use Symfony\Component\Form\FormInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; // ... - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'validation_groups' => function(FormInterface $form) { @@ -1090,9 +1090,9 @@ the choice is ultimately up to you. good idea to explicitly specify the ``data_class`` option by adding the following to your form type class:: - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Task', @@ -1321,7 +1321,7 @@ create a form class so that a ``Category`` object can be modified by the user:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class CategoryType extends AbstractType { @@ -1330,7 +1330,7 @@ create a form class so that a ``Category`` object can be modified by the user:: $builder->add('name'); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Category', @@ -1756,13 +1756,13 @@ that all un-rendered fields are output. The CSRF token can be customized on a form-by-form basis. For example:: - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class TaskType extends AbstractType { // ... - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Task', diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index 4e4abbb5a05..52bd31a2041 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -111,7 +111,7 @@ Next, create the form for the ``User`` model:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class UserType extends AbstractType { @@ -125,7 +125,7 @@ Next, create the form for the ``User`` model:: )); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'Acme\AccountBundle\Entity\User' diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index 62d1c454eeb..30976c7cc2e 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -24,11 +24,11 @@ for form fields, which is ``\Form\Type``. Make sure the field extend namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class GenderType extends AbstractType { - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'choices' => array( @@ -72,7 +72,7 @@ important: set) the ``multiple`` attribute on the ``select`` field. See `Creating a Template for the Field`_ for more details. -``setDefaultOptions()`` +``configureOptions()`` This defines options for your form type that can be used in ``buildForm()`` and ``buildView()``. There are a lot of options common to all fields (see :doc:`/reference/forms/types/form`), @@ -345,7 +345,7 @@ method to ``GenderType``, which receives the gender configuration:: // src/AppBundle/Form/Type/GenderType.php namespace AppBundle\Form\Type; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; // ... @@ -359,7 +359,7 @@ method to ``GenderType``, which receives the gender configuration:: $this->genderChoices = $genderChoices; } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'choices' => $this->genderChoices, diff --git a/cookbook/form/create_form_type_extension.rst b/cookbook/form/create_form_type_extension.rst index 02cef5f12b7..02ee079777a 100644 --- a/cookbook/form/create_form_type_extension.rst +++ b/cookbook/form/create_form_type_extension.rst @@ -83,7 +83,7 @@ to override one of the following methods: * ``buildView()`` -* ``setDefaultOptions()`` +* ``configureOptions()`` * ``finishView()`` @@ -178,7 +178,7 @@ database):: Your form type extension class will need to do two things in order to extend the ``file`` form type: -#. Override the ``setDefaultOptions`` method in order to add an ``image_path`` +#. Override the ``configureOptions`` method in order to add an ``image_path`` option; #. Override the ``buildForm`` and ``buildView`` methods in order to pass the image URL to the view. @@ -212,9 +212,9 @@ it in the view:: /** * Add the image_path option * - * @param OptionsResolverInterface $resolver + * @param OptionsResolver $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setOptional(array('image_path')); } diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index 072d02a1aa8..c2d5bc3294a 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -113,8 +113,9 @@ You can also use transformers without creating a new custom form type by calling ``addModelTransformer`` (or ``addViewTransformer`` - see `Model and View Transformers`_) on any field builder:: - use Symfony\Component\Form\FormBuilderInterface; use Acme\TaskBundle\Form\DataTransformer\IssueToNumberTransformer; + use Symfony\Component\Form\FormBuilderInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class TaskType extends AbstractType { @@ -133,7 +134,7 @@ by calling ``addModelTransformer`` (or ``addViewTransformer`` - see ); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver ->setDefaults(array( @@ -254,7 +255,7 @@ First, create the custom field type class:: use Symfony\Component\Form\FormBuilderInterface; use Acme\TaskBundle\Form\DataTransformer\IssueToNumberTransformer; use Doctrine\Common\Persistence\ObjectManager; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class IssueSelectorType extends AbstractType { @@ -277,7 +278,7 @@ First, create the custom field type class:: $builder->addModelTransformer($transformer); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'invalid_message' => 'The selected issue does not exist', diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index df1a9e9f24c..bd65f2c974e 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -41,7 +41,7 @@ a bare form class looks like:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class ProductType extends AbstractType { @@ -51,7 +51,7 @@ a bare form class looks like:: $builder->add('price'); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Product' @@ -224,7 +224,6 @@ Using an event listener, your form might look like this:: use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvent; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; class FriendMessageFormType extends AbstractType { @@ -243,10 +242,6 @@ Using an event listener, your form might look like this:: { return 'acme_friend_message'; } - - public function setDefaultOptions(OptionsResolverInterface $resolver) - { - } } The problem is now to get the current user and create a choice field that diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index 9793a67d357..b4f93a4f2a3 100644 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -84,7 +84,7 @@ Then, create a form class so that a ``Tag`` object can be modified by the user:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class TagType extends AbstractType { @@ -93,7 +93,7 @@ Then, create a form class so that a ``Tag`` object can be modified by the user:: $builder->add('name'); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'Acme\TaskBundle\Entity\Tag', @@ -118,7 +118,7 @@ Notice that you embed a collection of ``TagType`` forms using the use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class TaskType extends AbstractType { @@ -129,7 +129,7 @@ Notice that you embed a collection of ``TagType`` forms using the $builder->add('tags', 'collection', array('type' => new TagType())); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'Acme\TaskBundle\Entity\Task', diff --git a/cookbook/form/inherit_data_option.rst b/cookbook/form/inherit_data_option.rst index a4553f3847c..7429baae325 100644 --- a/cookbook/form/inherit_data_option.rst +++ b/cookbook/form/inherit_data_option.rst @@ -90,7 +90,7 @@ for that:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class LocationType extends AbstractType { @@ -103,7 +103,7 @@ for that:: ->add('country', 'text'); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'inherit_data' => true diff --git a/cookbook/form/use_empty_data.rst b/cookbook/form/use_empty_data.rst index 423165267c0..efc4a906126 100644 --- a/cookbook/form/use_empty_data.rst +++ b/cookbook/form/use_empty_data.rst @@ -39,7 +39,7 @@ that constructor with no arguments:: // ... use Symfony\Component\Form\AbstractType; use AppBundle\Entity\Blog; - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; class BlogType extends AbstractType { @@ -51,7 +51,7 @@ that constructor with no arguments:: } // ... - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'empty_data' => new Blog($this->someDependency), @@ -72,11 +72,11 @@ if it is needed. The closure must accept a ``FormInterface`` instance as the first argument:: - use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\FormInterface; // ... - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'empty_data' => function (FormInterface $form) { diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 49b39581d12..bfa2c3dc532 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -293,7 +293,7 @@ the interface directly:: class MyFormTypeExtension extends AbstractTypeExtension { // ... fill in whatever methods you want to override - // like buildForm(), buildView(), finishView(), setDefaultOptions() + // like buildForm(), buildView(), finishView(), configureOptions() } In order for Symfony to know about your form extension and use it, give it diff --git a/reference/forms/types/options/error_mapping.rst.inc b/reference/forms/types/options/error_mapping.rst.inc index 7b3c1359871..3159b562c66 100644 --- a/reference/forms/types/options/error_mapping.rst.inc +++ b/reference/forms/types/options/error_mapping.rst.inc @@ -13,7 +13,7 @@ of the form. With customized error mapping, you can do better: map the error to the city field so that it displays above it:: - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'error_mapping' => array( From 885c378fda0b5ed1579e49b2c5afaa150695ac2f Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 21 Jan 2015 17:45:19 -0500 Subject: [PATCH 11/23] [#4786] Adding a few versionadded's for the changed method name --- book/forms.rst | 4 ++++ cookbook/form/create_custom_field_type.rst | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/book/forms.rst b/book/forms.rst index f65d044b164..10c2efa43aa 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -470,6 +470,10 @@ you'll need to specify which validation group(s) your form should use:: 'validation_groups' => array('registration'), ))->add(...); +.. versionadded:: 2.7 + The ``configureOptions()`` method was introduced in Symfony 2.7. Previously, + the method was called ``setDefaultOptions()``. + If you're creating :ref:`form classes ` (a good practice), then you'll need to add the following to the ``configureOptions()`` method:: diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index 30976c7cc2e..40398c31034 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -72,6 +72,10 @@ important: set) the ``multiple`` attribute on the ``select`` field. See `Creating a Template for the Field`_ for more details. +.. versionadded:: 2.7 + The ``configureOptions()`` method was introduced in Symfony 2.7. Previously, + the method was called ``setDefaultOptions()``. + ``configureOptions()`` This defines options for your form type that can be used in ``buildForm()`` and ``buildView()``. There are a lot of From e4d22f079be08b460b5e92510007c6fe9c5a310e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 10 Jan 2015 08:25:47 +0100 Subject: [PATCH 12/23] added documentation for the new absolute_url() and relative_path() Twig functions --- reference/twig_reference.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 1e23c89c381..e58a68cc813 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -355,6 +355,38 @@ Returns the absolute URL (with scheme and host) for the given route. If ``schemeRelative`` is enabled, it'll create a scheme-relative URL. More information in :ref:`book-templating-pages`. +absolute_url +~~~~~~~~~~~~ + +.. code-block:: jinja + + {{ absolute_url(path) }} + +``path`` + **type**: ``string`` + +Returns the absolute URL for the given absolute path. This is useful to convert +an existing path: + +.. code-block:: jinja + + {{ absolute_url(asset(path)) }} + +relative_path +~~~~~~~~~~~~~ + +.. code-block:: jinja + + {{ relative_path(path) }} + +``path`` + **type**: ``string`` + +Returns a relative path for the given absolute path (based on the current +request path). For instance, if the current path is +``/article/news/welcome.html``, the relative path for ``/article/image.png`` is +``../images.png``. + expression ~~~~~~~~~~ From 6e6bae88eb62da17ed2e6f67979d621b54b21c01 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Sun, 25 Jan 2015 10:50:50 +0100 Subject: [PATCH 13/23] Small grammar-ish fix --- components/console/helpers/questionhelper.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index bf30da8cf27..6bc9b62c350 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -56,8 +56,8 @@ input will ask the same question again. The regex defaults to ``/^y/i``. .. versionadded:: 2.7 - The regex argument was introduced in Symfony 2.7, before only answers - starting with ``y`` were considered as yes. + The regex argument was introduced in Symfony 2.7. Before, only answers + starting with ``y`` were considered as "yes". Asking the User for Information ------------------------------- From 8fe906953f031e07159a2a29ce471b3b6afee410 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 10 Jan 2015 08:25:47 +0100 Subject: [PATCH 14/23] added documentation for the new absolute_url() and relative_path() Twig functions --- reference/twig_reference.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index cea12b6b1be..d644183a600 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -355,6 +355,38 @@ Returns the absolute URL (with scheme and host) for the given route. If ``schemeRelative`` is enabled, it'll create a scheme-relative URL. More information in :ref:`book-templating-pages`. +absolute_url +~~~~~~~~~~~~ + +.. code-block:: jinja + + {{ absolute_url(path) }} + +``path`` + **type**: ``string`` + +Returns the absolute URL for the given absolute path. This is useful to convert +an existing path: + +.. code-block:: jinja + + {{ absolute_url(asset(path)) }} + +relative_path +~~~~~~~~~~~~~ + +.. code-block:: jinja + + {{ relative_path(path) }} + +``path`` + **type**: ``string`` + +Returns a relative path for the given absolute path (based on the current +request path). For instance, if the current path is +``/article/news/welcome.html``, the relative path for ``/article/image.png`` is +``../images.png``. + expression ~~~~~~~~~~ From a5addaa079c507e761090f2428355732594df0f0 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 25 Jan 2015 12:58:02 -0500 Subject: [PATCH 15/23] [#4805] Adding versionadded --- reference/twig_reference.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index d644183a600..f21414ec8b3 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -358,6 +358,9 @@ information in :ref:`book-templating-pages`. absolute_url ~~~~~~~~~~~~ +.. versionadded:: 2.6 + The ``absolute_url`` function was introduced in Symfony 2.7 + .. code-block:: jinja {{ absolute_url(path) }} @@ -375,6 +378,9 @@ an existing path: relative_path ~~~~~~~~~~~~~ +.. versionadded:: 2.6 + The ``relative_path`` function was introduced in Symfony 2.7 + .. code-block:: jinja {{ relative_path(path) }} From ebe2706ac1fa815f0c0aae3ee578cfe8c11e03e8 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 1 Feb 2015 15:47:50 +0100 Subject: [PATCH 16/23] Added January changelog --- changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.rst b/changelog.rst index ad1a936bdde..d2ad460ac76 100644 --- a/changelog.rst +++ b/changelog.rst @@ -23,9 +23,11 @@ New Documentation - `ad74169 `_ #4628 Varnish cookbook session cookie handling (dbu) - `50c5a9e `_ #4895 Added configuration of the user provider (peterrehm) - `4226fc2 `_ #4883 Global dump (nicolas-grekas) +- `a57db5b `_ #4879 Documented true regex (WouterJ) - `3bb7b61 `_ #4645 Remove note that's no longer the case (thewilkybarkid) - `3293286 `_ #4801 [Cookbook][cache][varnish] be more precise about version differences (dbu) - `572bf3b `_ #4800 [Cookbook][Security] Hint about createToken can return null (xelaris) +- `74d2e30 `_ #4786 Replaced setDefaultOptions by the new configureOptions method (peterrehm) - `528e8e1 `_ #4740 Use AppBundle whenever it's possible (javiereguiluz) - `08e5ac9 `_ #4658 Debug formatter tweaks (weaverryan) - `cfad26c `_ #4605 Adding a link to log things in the prod environment (weaverryan) @@ -104,6 +106,7 @@ Minor Documentation Changes - `65b0822 `_ #4798 Add version added note for the debug:event-dispatcher command (adamelso) - `bcf1508 `_ #4785 [Book][Security] add back old anchors (xabbuh) - `4143076 `_ #4872 [BestPractices] fix merge after removing @Security in 2.3 (xabbuh) +- `dc25c65 `_ #4769 [2.7] Removed 2.5 versionadded as its deprecated (WouterJ) - `48835de `_ #4767 [2.6] Removed 2.4 versionadded as version is deprecated (WouterJ) - `240a981 `_ #4764 [Reference][Forms] move cautions to make them visible (xabbuh) - `cf3d38a `_ #4731 [Book][Testing] bump required PHPUnit version (xabbuh) From 6fd286beaf6e8f7e3bf3166d7b99db63f54c7839 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 1 Feb 2015 15:48:43 +0100 Subject: [PATCH 17/23] Added January changelog --- changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.rst b/changelog.rst index d2ad460ac76..6f699049631 100644 --- a/changelog.rst +++ b/changelog.rst @@ -25,6 +25,7 @@ New Documentation - `4226fc2 `_ #4883 Global dump (nicolas-grekas) - `a57db5b `_ #4879 Documented true regex (WouterJ) - `3bb7b61 `_ #4645 Remove note that's no longer the case (thewilkybarkid) +- `6c498d4 `_ #4805 added documentation for the new absolute_url() and relative_path() Twig functions (fabpot) - `3293286 `_ #4801 [Cookbook][cache][varnish] be more precise about version differences (dbu) - `572bf3b `_ #4800 [Cookbook][Security] Hint about createToken can return null (xelaris) - `74d2e30 `_ #4786 Replaced setDefaultOptions by the new configureOptions method (peterrehm) @@ -34,6 +35,7 @@ New Documentation - `3643ec2 `_ #4723 [Cookbook][Security] document the new AuthenticationUtils (xabbuh) - `9742b92 `_ #4761 [Cookbook][Security] don't output message from AuthenticationException (xabbuh) - `a23e7d2 `_ #4643 How to override vendor directory location (gajdaw) +- `ca3b4c8 `_ #4753 bump Symfony requirements to PHP 5.5 (xabbuh) - `99aca45 `_ #4749 [2.3][Book][Security] Add isPasswordValid doc as in 2.6 (xelaris) - `d9935a3 `_ #4141 Notes about caching pages with a CSRF Form (ricardclau) - `207f2f0 `_ #4711 [Reference] Add default_locale config description (xelaris) @@ -59,6 +61,7 @@ Fixed Documentation - `5940d52 `_ #4735 [BestPractices] remove @Security annotation for Symfony 2.3 (xabbuh) - `ce37b96 `_ #4771 [QuickTour] use the debug:router command name (xabbuh) - `ffe3425 `_ #4765 [Book][Forms] avoid the request service where possible (xabbuh) +- `92b10b1 `_ #4758 [Components][Yaml] don't describe removed usage of Yaml``::``parse() (xabbuh) - `36f2e1f `_ #4757 [Components][ClassLoader] don't show deprecated usage of Yaml``::``parse() (xabbuh) - `d8e8d75 `_ #4756 [Components][Config] don't show deprecated usage of Yaml``::``parse() (xabbuh) - `b143754 `_ #4744 [Book][Security] Update code example to fit description (xelaris) From ef39a01cb1a47500795d5dfa3bbbeeb4930d3d6a Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 1 Feb 2015 16:00:26 +0100 Subject: [PATCH 18/23] Remove diff --- changelog.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/changelog.rst b/changelog.rst index 64bb4d8088b..4c4ae8a00f9 100644 --- a/changelog.rst +++ b/changelog.rst @@ -64,7 +64,6 @@ Fixed Documentation - `92b10b1 `_ #4758 [Components][Yaml] don't describe removed usage of ``Yaml::parse()`` (xabbuh) - `36f2e1f `_ #4757 [Components][ClassLoader] don't show deprecated usage of ``Yaml::parse()`` (xabbuh) - `d8e8d75 `_ #4756 [Components][Config] don't show deprecated usage of ``Yaml::parse()`` (xabbuh) ->>>>>>> 2.7 - `b143754 `_ #4744 [Book][Security] Update code example to fit description (xelaris) - `310f4ae `_ #4639 Update by_reference.rst.inc (docteurklein) From b7f7421e10c88c4138bb4021fee96a1047beaf7a Mon Sep 17 00:00:00 2001 From: solazs Date: Wed, 11 Feb 2015 16:43:56 +0100 Subject: [PATCH 19/23] Update translation.rst Clarify that changing the locale in the controller would not affect template rendering as the translator reads the request locale during the kernel.request event. --- book/translation.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/book/translation.rst b/book/translation.rst index e2170afaaf3..b30c6538362 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -428,6 +428,14 @@ via the ``request`` object:: $request->setLocale('en_US'); } + + +.. note:: + + Setting the locale using ``$request->setLocale()`` won't affect rendering + in the same action as the translator reads the request locale during the + kernel.request event, so changing it here would be too late. To manually + change translation locale in the controller use ``$this->get('translator')->setLocale()``. .. tip:: From 94914c5c703f2e7ef0809ac001024d1773c16162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Solt=C3=A9sz=20Bal=C3=A1zs?= Date: Sun, 15 Feb 2015 16:01:19 +0100 Subject: [PATCH 20/23] Review note about setting the translator locale in a controller. --- book/translation.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/book/translation.rst b/book/translation.rst index b30c6538362..52ff04f46fd 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -429,13 +429,13 @@ via the ``request`` object:: $request->setLocale('en_US'); } - .. note:: - Setting the locale using ``$request->setLocale()`` won't affect rendering - in the same action as the translator reads the request locale during the - kernel.request event, so changing it here would be too late. To manually - change translation locale in the controller use ``$this->get('translator')->setLocale()``. + Setting the locale using the ``$request->setLocale()`` method won't affect + rendering in the same action. The translator locale is set during the + kernel.request event. Either set the locale before the listener is called + (e.g. in a custom listener) or use the ``setLocale()`` method of the + ``translator`` service. .. tip:: From d5566b15b4d0ce0d7c4e064d2c0aa7fdcac0047d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Solt=C3=A9sz=20Bal=C3=A1zs?= Date: Fri, 20 Feb 2015 02:26:32 +0100 Subject: [PATCH 21/23] Finaly touches on translation locale setting note --- book/translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/translation.rst b/book/translation.rst index 52ff04f46fd..8b43f9f4a2e 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -433,7 +433,7 @@ via the ``request`` object:: Setting the locale using the ``$request->setLocale()`` method won't affect rendering in the same action. The translator locale is set during the - kernel.request event. Either set the locale before the listener is called + ``kernel.request`` event. Either set the locale before the listener is called (e.g. in a custom listener) or use the ``setLocale()`` method of the ``translator`` service. From cbc91e39a9dea9336c1d64c562a2b1dc09756c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Solt=C3=A9sz=20Bal=C3=A1zs?= Date: Fri, 6 Mar 2015 16:24:45 +0100 Subject: [PATCH 22/23] Remove useless setLocale() call and add code block with locale setter --- book/translation.rst | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/book/translation.rst b/book/translation.rst index 691163a103c..20056898912 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -425,22 +425,35 @@ via the ``request`` object:: public function indexAction(Request $request) { $locale = $request->getLocale(); - - $request->setLocale('en_US'); } +To store the user's locale in the session you may want to create a custom event listener and set the locale there:: + + public function onKernelRequest(GetResponseEvent $event) + { + $request = $event->getRequest(); + if (!$request->hasPreviousSession()) { + return; + } + + // try to see if the locale has been set as a _locale routing parameter + if ($locale = $request->attributes->get('_locale')) { + $request->getSession()->set('_locale', $locale); + } else { + // if no explicit locale has been set on this request, use one from the session + $request->setLocale($request->getSession()->get('_locale', $this->defaultLocale)); + } + } + +Read :doc:`/cookbook/session/locale_sticky_session` for more on the topic. + .. note:: Setting the locale using the ``$request->setLocale()`` method won't affect rendering in the same action. The translator locale is set during the ``kernel.request`` event. Either set the locale before the listener is called - (e.g. in a custom listener) or use the ``setLocale()`` method of the - ``translator`` service. - -.. tip:: - - Read :doc:`/cookbook/session/locale_sticky_session` to learn how to store - the user's locale in the session. + (e.g. in a custom listener described above) or use the ``setLocale()`` method + of the ``translator`` service. .. index:: single: Translations; Fallback and default locale From 30b4dfaf277bf999ccf8c2ce7e96c02c7455e04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Solt=C3=A9sz=20Bal=C3=A1zs?= Date: Fri, 6 Mar 2015 16:31:49 +0100 Subject: [PATCH 23/23] Revert "Merge branch 'master' of https://github.com/solazs/symfony-docs into patch-1" This reverts commit fdae4bc034bb5ddcf53c08060e84deb00c272b09, reversing changes made to d5566b15b4d0ce0d7c4e064d2c0aa7fdcac0047d. --- best_practices/forms.rst | 4 +- book/controller.rst | 2 +- book/forms.rst | 38 +++++++++---------- book/installation.rst | 18 ++++++++- book/security.rst | 10 +++++ book/templating.rst | 6 +++ book/translation.rst | 11 ++++-- book/validation.rst | 3 ++ changelog.rst | 6 --- components/class_loader/psr4_class_loader.rst | 4 ++ .../console/changing_default_command.rst | 4 ++ components/console/helpers/progressbar.rst | 4 ++ components/console/helpers/questionhelper.rst | 21 ++-------- components/console/helpers/table.rst | 4 ++ components/console/logger.rst | 4 ++ components/dependency_injection/advanced.rst | 3 ++ .../event_dispatcher/traceable_dispatcher.rst | 4 ++ components/form/introduction.rst | 8 ++++ .../http_foundation/session_configuration.rst | 17 +++++++++ components/process.rst | 8 ++++ components/property_access/introduction.rst | 7 ++++ components/serializer.rst | 5 +++ components/stopwatch.rst | 3 ++ .../templating/helpers/assetshelper.rst | 6 +++ components/yaml/introduction.rst | 6 +++ contributing/code/patches.rst | 2 +- cookbook/bundles/best_practices.rst | 9 +++-- cookbook/console/console_command.rst | 10 +++++ cookbook/deployment/azure-website.rst | 5 ++- cookbook/doctrine/registration_form.rst | 4 +- cookbook/form/create_custom_field_type.rst | 14 +++---- cookbook/form/create_form_type_extension.rst | 8 ++-- cookbook/form/data_transformers.rst | 9 ++--- cookbook/form/dynamic_form_modification.rst | 9 ++++- cookbook/form/form_collections.rst | 8 ++-- cookbook/form/inherit_data_option.rst | 4 +- cookbook/form/use_empty_data.rst | 8 ++-- cookbook/logging/monolog.rst | 4 +- cookbook/request/mime_type.rst | 3 ++ .../_ircmaxwell_password-compat.rst.inc | 13 +++++++ cookbook/security/acl_advanced.rst | 7 ++++ cookbook/security/entity_provider.rst | 2 + cookbook/security/firewall_restriction.rst | 4 ++ cookbook/security/named_encoders.rst | 3 ++ cookbook/validation/custom_constraint.rst | 5 +++ cookbook/web_server/built_in.rst | 9 +++-- quick_tour/the_big_picture.rst | 4 +- reference/configuration/framework.rst | 3 +- reference/constraints/Callback.rst | 5 +++ reference/constraints/Email.rst | 3 ++ reference/constraints/Uuid.rst | 3 ++ reference/dic_tags.rst | 2 +- reference/forms/types/collection.rst | 3 ++ reference/forms/types/file.rst | 3 ++ .../forms/types/options/error_mapping.rst.inc | 2 +- reference/requirements.rst | 10 ++++- reference/twig_reference.rst | 38 ------------------- 57 files changed, 279 insertions(+), 143 deletions(-) create mode 100644 cookbook/security/_ircmaxwell_password-compat.rst.inc diff --git a/best_practices/forms.rst b/best_practices/forms.rst index 3655c298750..d72d189ccfb 100644 --- a/best_practices/forms.rst +++ b/best_practices/forms.rst @@ -21,7 +21,7 @@ form in its own PHP class:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class PostType extends AbstractType { @@ -36,7 +36,7 @@ form in its own PHP class:: ; } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Post' diff --git a/book/controller.rst b/book/controller.rst index e79af5c803c..dc8a7c663d9 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -116,7 +116,7 @@ Controllers are also called *actions*. This controller is pretty straightforward: -* *line 4*: Symfony takes advantage of PHP's namespace functionality to +* *line 4*: Symfony takes advantage of PHP 5.3 namespace functionality to namespace the entire controller class. The ``use`` keyword imports the ``Response`` class, which the controller must return. diff --git a/book/forms.rst b/book/forms.rst index b16a4751b4e..7bdfd2d991c 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -470,17 +470,13 @@ you'll need to specify which validation group(s) your form should use:: 'validation_groups' => array('registration'), ))->add(...); -.. versionadded:: 2.7 - The ``configureOptions()`` method was introduced in Symfony 2.7. Previously, - the method was called ``setDefaultOptions()``. - If you're creating :ref:`form classes ` (a -good practice), then you'll need to add the following to the ``configureOptions()`` +good practice), then you'll need to add the following to the ``setDefaultOptions()`` method:: - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'validation_groups' => array('registration'), @@ -502,9 +498,9 @@ Disabling Validation Sometimes it is useful to suppress the validation of a form altogether. For these cases you can set the ``validation_groups`` option to ``false``:: - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'validation_groups' => false, @@ -528,10 +524,10 @@ If you need some advanced logic to determine the validation groups (e.g. based on submitted data), you can set the ``validation_groups`` option to an array callback:: - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; // ... - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'validation_groups' => array( @@ -548,10 +544,10 @@ You can also define whole logic inline by using a ``Closure``:: use Acme\AcmeBundle\Entity\Client; use Symfony\Component\Form\FormInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; // ... - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'validation_groups' => function(FormInterface $form) { @@ -571,10 +567,10 @@ of the entity as well you have to adjust the option as follows:: use Acme\AcmeBundle\Entity\Client; use Symfony\Component\Form\FormInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; // ... - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'validation_groups' => function(FormInterface $form) { @@ -1094,9 +1090,9 @@ the choice is ultimately up to you. good idea to explicitly specify the ``data_class`` option by adding the following to your form type class:: - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Task', @@ -1325,7 +1321,7 @@ create a form class so that a ``Category`` object can be modified by the user:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class CategoryType extends AbstractType { @@ -1334,7 +1330,7 @@ create a form class so that a ``Category`` object can be modified by the user:: $builder->add('name'); } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Category', @@ -1760,13 +1756,13 @@ that all un-rendered fields are output. The CSRF token can be customized on a form-by-form basis. For example:: - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class TaskType extends AbstractType { // ... - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Task', diff --git a/book/installation.rst b/book/installation.rst index 7ed45ab5d18..52b79df7f90 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -16,6 +16,13 @@ Using the Symfony Installer is the only recommended way to create new Symfony applications. This installer is a PHP application that has to be installed only once and then it can create any number of Symfony applications. +.. note:: + + The installer requires PHP 5.4 or higher. If you still use the legacy + PHP 5.3 version, you cannot use the Symfony Installer. Read the + :ref:`book-creating-applications-without-the-installer` section to learn how + to proceed. + Depending on your operating system, the installer must be installed in different ways. @@ -100,8 +107,9 @@ to use for your projects. Creating Symfony Applications without the Installer --------------------------------------------------- -If you can't execute the installer for any reason, you can create Symfony -applications using the alternative installation method based on `Composer`_. +If you still use PHP 5.3, or if you can't execute the installer for any reason, +you can create Symfony applications using the alternative installation method +based on `Composer`_. Composer is the dependency manager used by modern PHP applications and it can also be used to create new applications based on the Symfony framework. If you @@ -160,6 +168,12 @@ possible solutions depending on your operating system. All of them are explained in the :ref:`Setting up Permissions ` section. +.. note:: + + PHP's internal web server is available in PHP 5.4 or higher versions. If you + still use the legacy PHP 5.3 version, you'll have to configure a *virtual host* + in your web server. + The ``server:run`` command is only suitable while developing the application. In order to run Symfony applications on production servers, you'll have to configure your `Apache`_ or `Nginx`_ web server as explained in diff --git a/book/security.rst b/book/security.rst index 6bf4df17a09..4193eed7e1b 100644 --- a/book/security.rst +++ b/book/security.rst @@ -499,6 +499,8 @@ else, you'll want to encode their passwords. The best algorithm to use is // ... )); +.. include:: /cookbook/security/_ircmaxwell_password-compat.rst.inc + Of course, your user's passwords now need to be encoded with this exact algorithm. For hardcoded users, you can use an `online tool`_, which will give you something like this: @@ -822,6 +824,9 @@ You can easily deny access from inside a controller:: The ``security.authorization_checker`` service was introduced in Symfony 2.6. Prior to Symfony 2.6, you had to use the ``isGranted()`` method of the ``security.context`` service. +.. versionadded:: 2.5 + The ``createAccessDeniedException`` method was introduced in Symfony 2.5. + The :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::createAccessDeniedException` method creates a special :class:`Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException` object, which ultimately triggers a 403 HTTP response inside Symfony. @@ -1312,6 +1317,11 @@ cookie will be ever created by Symfony): Checking for Known Security Vulnerabilities in Dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 2.5 + The ``security:check`` command was introduced in Symfony 2.5. This command is + included in ``SensioDistributionBundle``, which has to be registered in your + application in order to use this command. + When using lots of dependencies in your Symfony projects, some of them may contain security vulnerabilities. That's why Symfony includes a command called ``security:check`` that checks your ``composer.lock`` file to find any known diff --git a/book/templating.rst b/book/templating.rst index 16ddf223b0b..d8a4fba2cf0 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1021,6 +1021,9 @@ configuration option. .. _`book-templating-version-by-asset`: +.. versionadded:: 2.5 + Setting versioned URLs on an asset-by-asset basis was introduced in Symfony 2.5. + If you need to set a version for a specific asset, you can set the fourth argument (or the ``version`` argument) to the desired version: @@ -1043,6 +1046,9 @@ If you don't give a version or pass ``null``, the default package version (from :ref:`ref-framework-assets-version`) will be used. If you pass ``false``, versioned URL will be deactivated for this asset. +.. versionadded:: 2.5 + Absolute URLs for assets were introduced in Symfony 2.5. + If you need absolute URLs for assets, you can set the third argument (or the ``absolute`` argument) to ``true``: diff --git a/book/translation.rst b/book/translation.rst index 20056898912..04b65788c0b 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -408,8 +408,8 @@ checks translation resources for several locales: .. note:: - When Symfony doesn't find a translation in the given locale, it will - add the missing translation to the log file. For details, + When Symfony doesn't find a translation in the given locale, it will + add the missing translation to the log file. For details, see :ref:`reference-framework-translator-logging`. .. _book-translation-user-locale: @@ -696,12 +696,15 @@ Translating Database Content ---------------------------- The translation of database content should be handled by Doctrine through -the `Translatable Extension`_ or the `Translatable Behavior`_. For more information, -see the documentation for these libraries. +the `Translatable Extension`_ or the `Translatable Behavior`_ (PHP 5.4+). +For more information, see the documentation for these libraries. Debugging Translations ---------------------- +.. versionadded:: 2.5 + The ``debug:translation`` command was introduced in Symfony 2.5. + .. versionadded:: 2.6 Prior to Symfony 2.6, this command was called ``translation:debug``. diff --git a/book/validation.rst b/book/validation.rst index 4086f01c02c..8d34630e04d 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -586,6 +586,9 @@ allows you to add a constraint to any public method whose name starts with "get", "is" or "has". In this guide, these types of methods are referred to as "getters". +.. versionadded:: 2.5 + Support for methods starting with ``has`` was introduced in Symfony 2.5. + The benefit of this technique is that it allows you to validate your object dynamically. For example, suppose you want to make sure that a password field doesn't match the first name of the user (for security reasons). You can diff --git a/changelog.rst b/changelog.rst index 4c4ae8a00f9..7a213ebf0a2 100644 --- a/changelog.rst +++ b/changelog.rst @@ -23,19 +23,15 @@ New Documentation - `ad74169 `_ #4628 Varnish cookbook session cookie handling (dbu) - `50c5a9e `_ #4895 Added configuration of the user provider (peterrehm) - `4226fc2 `_ #4883 Global dump (nicolas-grekas) -- `a57db5b `_ #4879 Documented true regex (WouterJ) - `3bb7b61 `_ #4645 Remove note that's no longer the case (thewilkybarkid) -- `6c498d4 `_ #4805 added documentation for the new absolute_url() and relative_path() Twig functions (fabpot) - `3293286 `_ #4801 [Cookbook][cache][varnish] be more precise about version differences (dbu) - `572bf3b `_ #4800 [Cookbook][Security] Hint about createToken can return null (xelaris) -- `74d2e30 `_ #4786 Replaced setDefaultOptions by the new configureOptions method (peterrehm) - `528e8e1 `_ #4740 Use AppBundle whenever it's possible (javiereguiluz) - `08e5ac9 `_ #4658 Debug formatter tweaks (weaverryan) - `cfad26c `_ #4605 Adding a link to log things in the prod environment (weaverryan) - `3643ec2 `_ #4723 [Cookbook][Security] document the new AuthenticationUtils (xabbuh) - `9742b92 `_ #4761 [Cookbook][Security] don't output message from AuthenticationException (xabbuh) - `a23e7d2 `_ #4643 How to override vendor directory location (gajdaw) -- `ca3b4c8 `_ #4753 bump Symfony requirements to PHP 5.5 (xabbuh) - `99aca45 `_ #4749 [2.3][Book][Security] Add isPasswordValid doc as in 2.6 (xelaris) - `d9935a3 `_ #4141 Notes about caching pages with a CSRF Form (ricardclau) - `207f2f0 `_ #4711 [Reference] Add default_locale config description (xelaris) @@ -61,7 +57,6 @@ Fixed Documentation - `5940d52 `_ #4735 [BestPractices] remove @Security annotation for Symfony 2.3 (xabbuh) - `ce37b96 `_ #4771 [QuickTour] use the debug:router command name (xabbuh) - `ffe3425 `_ #4765 [Book][Forms] avoid the request service where possible (xabbuh) -- `92b10b1 `_ #4758 [Components][Yaml] don't describe removed usage of ``Yaml::parse()`` (xabbuh) - `36f2e1f `_ #4757 [Components][ClassLoader] don't show deprecated usage of ``Yaml::parse()`` (xabbuh) - `d8e8d75 `_ #4756 [Components][Config] don't show deprecated usage of ``Yaml::parse()`` (xabbuh) - `b143754 `_ #4744 [Book][Security] Update code example to fit description (xelaris) @@ -109,7 +104,6 @@ Minor Documentation Changes - `65b0822 `_ #4798 Add version added note for the debug:event-dispatcher command (adamelso) - `bcf1508 `_ #4785 [Book][Security] add back old anchors (xabbuh) - `4143076 `_ #4872 [BestPractices] fix merge after removing @Security in 2.3 (xabbuh) -- `dc25c65 `_ #4769 [2.7] Removed 2.5 versionadded as its deprecated (WouterJ) - `48835de `_ #4767 [2.6] Removed 2.4 versionadded as version is deprecated (WouterJ) - `240a981 `_ #4764 [Reference][Forms] move cautions to make them visible (xabbuh) - `cf3d38a `_ #4731 [Book][Testing] bump required PHPUnit version (xabbuh) diff --git a/components/class_loader/psr4_class_loader.rst b/components/class_loader/psr4_class_loader.rst index b593e174027..33915b16a9e 100644 --- a/components/class_loader/psr4_class_loader.rst +++ b/components/class_loader/psr4_class_loader.rst @@ -4,6 +4,10 @@ The PSR-4 Class Loader ====================== +.. versionadded:: 2.5 + The :class:`Symfony\\Component\\ClassLoader\\Psr4ClassLoader` was + introduced in Symfony 2.5. + Libraries that follow the `PSR-4`_ standard can be loaded with the ``Psr4ClassLoader``. .. note:: diff --git a/components/console/changing_default_command.rst b/components/console/changing_default_command.rst index adbf31a4ae3..590cf3577e1 100644 --- a/components/console/changing_default_command.rst +++ b/components/console/changing_default_command.rst @@ -4,6 +4,10 @@ Changing the Default Command ============================ +.. versionadded:: 2.5 + The :method:`Symfony\\Component\\Console\\Application::setDefaultCommand` + method was introduced in Symfony 2.5. + The Console component will always run the ``ListCommand`` when no command name is passed. In order to change the default command you just need to pass the command name to the ``setDefaultCommand`` method:: diff --git a/components/console/helpers/progressbar.rst b/components/console/helpers/progressbar.rst index 915efa8f158..1b8edf309cc 100644 --- a/components/console/helpers/progressbar.rst +++ b/components/console/helpers/progressbar.rst @@ -4,6 +4,10 @@ Progress Bar ============ +.. versionadded:: 2.5 + The Progress Bar feature was introduced in Symfony 2.5 as a replacement for + the :doc:`Progress Helper `. + When executing longer-running commands, it may be helpful to show progress information, which updates as your command runs: diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index dbd57c15e0c..1d972a933c5 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -4,6 +4,9 @@ Question Helper =============== +.. versionadded:: 2.5 + The Question Helper was introduced in Symfony 2.5. + The :class:`Symfony\\Component\\Console\\Helper\\QuestionHelper` provides functions to ask the user for more information. It is included in the default helper set, which you can get by calling @@ -41,24 +44,6 @@ The second argument to is the default value to return if the user doesn't enter any input. Any other input will ask the same question again. -.. tip:: - - You can customize the regex used to check if the answer means "yes" in the - third argument of the constructor. For instance, to allow anything that - starts with either ``y`` or ``j``, you would set it to:: - - $question = new ConfirmationQuestion( - 'Continue with this action?', - false, - '/^(y|j)/i' - ); - - The regex defaults to ``/^y/i``. - - .. versionadded:: 2.7 - The regex argument was introduced in Symfony 2.7. Before, only answers - starting with ``y`` were considered as "yes". - Asking the User for Information ------------------------------- diff --git a/components/console/helpers/table.rst b/components/console/helpers/table.rst index f8e4591d99b..0f3511fe040 100644 --- a/components/console/helpers/table.rst +++ b/components/console/helpers/table.rst @@ -4,6 +4,10 @@ Table ===== +.. versionadded:: 2.5 + The ``Table`` class was introduced in Symfony 2.5 as a replacement for the + :doc:`Table Helper `. + When building a console application it may be useful to display tabular data: .. code-block:: text diff --git a/components/console/logger.rst b/components/console/logger.rst index 3f9d9036765..43951c63130 100644 --- a/components/console/logger.rst +++ b/components/console/logger.rst @@ -4,6 +4,10 @@ Using the Logger ================ +.. versionadded:: 2.5 + The :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger` was + introduced in Symfony 2.5. + The Console component comes with a standalone logger complying with the `PSR-3`_ standard. Depending on the verbosity setting, log messages will be sent to the :class:`Symfony\\Component\\Console\\Output\\OutputInterface` diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 507908ab350..cbf50ff4fae 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -227,6 +227,9 @@ which means that your file will be included only once per request. Decorating Services ------------------- +.. versionadded:: 2.5 + Decorated services were introduced in Symfony 2.5. + When overriding an existing definition, the old service is lost: .. code-block:: php diff --git a/components/event_dispatcher/traceable_dispatcher.rst b/components/event_dispatcher/traceable_dispatcher.rst index d023d429ae5..103c35150e1 100644 --- a/components/event_dispatcher/traceable_dispatcher.rst +++ b/components/event_dispatcher/traceable_dispatcher.rst @@ -5,6 +5,10 @@ The Traceable Event Dispatcher ============================== +.. versionadded:: 2.5 + The ``TraceableEventDispatcher`` class was moved to the EventDispatcher + component in Symfony 2.5. Before, it was located in the HttpKernel component. + The :class:`Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher` is an event dispatcher that wraps any other event dispatcher and can then be used to determine which event listeners have been called by the dispatcher. diff --git a/components/form/introduction.rst b/components/form/introduction.rst index c53e7cd2451..7321a1029a1 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -663,6 +663,14 @@ and the errors will display next to the fields on error. Accessing Form Errors ~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 2.5 + Before Symfony 2.5, ``getErrors()`` returned an array of ``FormError`` + objects. The return value was changed to ``FormErrorIterator`` in Symfony + 2.5. + +.. versionadded:: 2.5 + The ``$deep`` and ``$flatten`` arguments were introduced in Symfony 2.5. + You can use the :method:`Symfony\\Component\\Form\\FormInterface::getErrors` method to access the list of errors. It returns a :class:`Symfony\\Component\\Form\\FormErrorIterator` instance:: diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index f6b412e488e..c2608110621 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -218,6 +218,23 @@ particular cookie by reading the ``getLifetime()`` method:: The expiry time of the cookie can be determined by adding the created timestamp and the lifetime. +PHP 5.4 Compatibility +~~~~~~~~~~~~~~~~~~~~~ + +Since PHP 5.4.0, :phpclass:`SessionHandler` and :phpclass:`SessionHandlerInterface` +are available. Symfony provides forward compatibility for the :phpclass:`SessionHandlerInterface` +so it can be used under PHP 5.3. This greatly improves interoperability with other +libraries. + +:phpclass:`SessionHandler` is a special PHP internal class which exposes native save +handlers to PHP user-space. + +In order to provide a solution for those using PHP 5.4, Symfony has a special +class called :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler` +which under PHP 5.4, extends from ``\SessionHandler`` and under PHP 5.3 is just a +empty base class. This provides some interesting opportunities to leverage +PHP 5.4 functionality if it is available. + Save Handler Proxy ~~~~~~~~~~~~~~~~~~ diff --git a/components/process.rst b/components/process.rst index 631bb5d594a..c73c380173f 100644 --- a/components/process.rst +++ b/components/process.rst @@ -47,6 +47,9 @@ the contents of the output and :method:`Symfony\\Component\\Process\\Process::clearErrorOutput` clears the contents of the error output. +.. versionadded:: 2.5 + The ``mustRun()`` method was introduced in Symfony 2.5. + The ``mustRun()`` method is identical to ``run()``, except that it will throw a :class:`Symfony\\Component\\Process\\Exception\\ProcessFailedException` if the process couldn't be executed successfully (i.e. the process exited @@ -296,6 +299,11 @@ You can access the `pid`_ of a running process with the Disabling Output ---------------- +.. versionadded:: 2.5 + The :method:`Symfony\\Component\\Process\\Process::disableOutput` and + :method:`Symfony\\Component\\Process\\Process::enableOutput` methods were + introduced in Symfony 2.5. + As standard output and error output are always fetched from the underlying process, it might be convenient to disable output in some cases to save memory. Use :method:`Symfony\\Component\\Process\\Process::disableOutput` and diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 1ab83d19d0e..d8d4c774610 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -314,6 +314,13 @@ see `Enable other Features`_. Checking Property Paths ----------------------- +.. versionadded:: 2.5 + The + :method:`PropertyAccessor::isReadable ` + and + :method:`PropertyAccessor::isWritable ` + methods were introduced in Symfony 2.5. + When you want to check whether :method:`PropertyAccessor::getValue` can safely be called without actually calling that method, you can use diff --git a/components/serializer.rst b/components/serializer.rst index 324b39fd3b0..6480fcfd048 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -198,6 +198,11 @@ it were ``firstName`` and uses the ``getFirstName`` and ``setFirstName`` methods Serializing Boolean Attributes ------------------------------ +.. versionadded:: 2.5 + Support for ``is*`` accessors in + :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer` + was introduced in Symfony 2.5. + If you are using isser methods (methods prefixed by ``is``, like ``Acme\Person::isSportsman()``), the Serializer component will automatically detect and use it to serialize related attributes. diff --git a/components/stopwatch.rst b/components/stopwatch.rst index fccd56675a7..58c76b85cff 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -31,6 +31,9 @@ microtime by yourself. Instead, use the simple // ... some code goes here $event = $stopwatch->stop('eventName'); +.. versionadded:: 2.5 + The ``getEvent()`` method was introduced in Symfony 2.5 + The :class:`Symfony\\Component\\Stopwatch\\StopwatchEvent` object can be retrieved from the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::start`, :method:`Symfony\\Component\\Stopwatch\\Stopwatch::stop`, diff --git a/components/templating/helpers/assetshelper.rst b/components/templating/helpers/assetshelper.rst index 837b94255bc..583dfc4d74c 100644 --- a/components/templating/helpers/assetshelper.rst +++ b/components/templating/helpers/assetshelper.rst @@ -47,6 +47,9 @@ You can also specify a URL to use in the second parameter of the constructor:: Now URLs are rendered like ``http://cdn.example.com/images/logo.png``. +.. versionadded:: 2.5 + Absolute URLs for assets were introduced in Symfony 2.5. + You can also use the third argument of the helper to force an absolute URL: .. code-block:: html+php @@ -77,6 +80,9 @@ is used in :phpfunction:`sprintf`. The first argument is the path and the second is the version. For instance, ``%s?v=%s`` will be rendered as ``/images/logo.png?v=328rad75``. +.. versionadded:: 2.5 + On-demand versioned URLs for assets were introduced in Symfony 2.5. + You can also generate a versioned URL on an asset-by-asset basis using the fourth argument of the helper: diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index 4ad0f833274..e7e92270493 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -138,6 +138,12 @@ string or a file containing YAML. Internally, it calls the :method:`Symfony\\Component\\Yaml\\Parser::parse` method, but enhances the error if something goes wrong by adding the filename to the message. +.. caution:: + + Because it is currently possible to pass a filename to this method, you + must validate the input first. Passing a filename is deprecated in + Symfony 2.2, and will be removed in Symfony 3.0. + .. _components-yaml-dump: Writing YAML Files diff --git a/contributing/code/patches.rst b/contributing/code/patches.rst index 13581d1d8eb..1f9bf7000e5 100644 --- a/contributing/code/patches.rst +++ b/contributing/code/patches.rst @@ -14,7 +14,7 @@ Before working on Symfony, setup a friendly environment with the following software: * Git; -* PHP version 5.5.9 or above; +* PHP version 5.3.3 or above; * `PHPUnit`_ 4.2 or above. Configure Git diff --git a/cookbook/bundles/best_practices.rst b/cookbook/bundles/best_practices.rst index 901e9bd2aa9..8d0ecead684 100644 --- a/cookbook/bundles/best_practices.rst +++ b/cookbook/bundles/best_practices.rst @@ -29,9 +29,10 @@ Bundle Name ----------- A bundle is also a PHP namespace. The namespace must follow the technical -interoperability `standards`_ for PHP namespaces and class names: it starts -with a vendor segment, followed by zero or more category segments, and it -ends with the namespace short name, which must end with a ``Bundle`` suffix. +interoperability `standards`_ for PHP 5.3 namespaces and class names: it +starts with a vendor segment, followed by zero or more category segments, and +it ends with the namespace short name, which must end with a ``Bundle`` +suffix. A namespace becomes a bundle as soon as you add a bundle class to it. The bundle class name must follow these simple rules: @@ -346,7 +347,7 @@ there are 3 modes, which the user can configure in their project: * 2.4: the original 2.4 and earlier validation API; * 2.5: the new 2.5 and later validation API; * 2.5-BC: the new 2.5 API with a backwards-compatible layer so that the - 2.4 API still works. + 2.4 API still works. This is only available in PHP 5.3.9+. As a bundle author, you'll want to support *both* API's, since some users may still be using the 2.4 API. Specifically, if your bundle adds a violation diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index 11d22e99756..d0b651fc6d8 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -233,3 +233,13 @@ you can extend your test from // ... } } + +.. versionadded:: 2.5 + :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase` was + extracted from :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase` + in Symfony 2.5. ``WebTestCase`` inherits from ``KernelTestCase``. The + ``WebTestCase`` creates an instance of + :class:`Symfony\\Bundle\\FrameworkBundle\\Client` via ``createClient()``, + while ``KernelTestCase`` creates an instance of + :class:`Symfony\\Component\\HttpKernel\\KernelInterface` via + ``createKernel()``. diff --git a/cookbook/deployment/azure-website.rst b/cookbook/deployment/azure-website.rst index 36d61f26bb7..efee282260e 100644 --- a/cookbook/deployment/azure-website.rst +++ b/cookbook/deployment/azure-website.rst @@ -96,8 +96,9 @@ and how to properly configure PHP for a production environment. Configuring the latest PHP Runtime ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Even though Symfony only requires PHP 5.5.9 to run, it's always recommended -to use the most recent PHP version whenever possible. +Even though Symfony only requires PHP 5.3.3 to run, it's always recommended +to use the most recent PHP version whenever possible. PHP 5.3 is no longer +supported by the PHP core team, but you can update it easily in Azure. To update your PHP version on Azure, go to the **Configure** tab of the control panel and select the version you want. diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index 52bd31a2041..4e4abbb5a05 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -111,7 +111,7 @@ Next, create the form for the ``User`` model:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class UserType extends AbstractType { @@ -125,7 +125,7 @@ Next, create the form for the ``User`` model:: )); } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Acme\AccountBundle\Entity\User' diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index 40398c31034..62d1c454eeb 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -24,11 +24,11 @@ for form fields, which is ``\Form\Type``. Make sure the field extend namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class GenderType extends AbstractType { - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'choices' => array( @@ -72,11 +72,7 @@ important: set) the ``multiple`` attribute on the ``select`` field. See `Creating a Template for the Field`_ for more details. -.. versionadded:: 2.7 - The ``configureOptions()`` method was introduced in Symfony 2.7. Previously, - the method was called ``setDefaultOptions()``. - -``configureOptions()`` +``setDefaultOptions()`` This defines options for your form type that can be used in ``buildForm()`` and ``buildView()``. There are a lot of options common to all fields (see :doc:`/reference/forms/types/form`), @@ -349,7 +345,7 @@ method to ``GenderType``, which receives the gender configuration:: // src/AppBundle/Form/Type/GenderType.php namespace AppBundle\Form\Type; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; // ... @@ -363,7 +359,7 @@ method to ``GenderType``, which receives the gender configuration:: $this->genderChoices = $genderChoices; } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'choices' => $this->genderChoices, diff --git a/cookbook/form/create_form_type_extension.rst b/cookbook/form/create_form_type_extension.rst index 02ee079777a..02cef5f12b7 100644 --- a/cookbook/form/create_form_type_extension.rst +++ b/cookbook/form/create_form_type_extension.rst @@ -83,7 +83,7 @@ to override one of the following methods: * ``buildView()`` -* ``configureOptions()`` +* ``setDefaultOptions()`` * ``finishView()`` @@ -178,7 +178,7 @@ database):: Your form type extension class will need to do two things in order to extend the ``file`` form type: -#. Override the ``configureOptions`` method in order to add an ``image_path`` +#. Override the ``setDefaultOptions`` method in order to add an ``image_path`` option; #. Override the ``buildForm`` and ``buildView`` methods in order to pass the image URL to the view. @@ -212,9 +212,9 @@ it in the view:: /** * Add the image_path option * - * @param OptionsResolver $resolver + * @param OptionsResolverInterface $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setOptional(array('image_path')); } diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index c2d5bc3294a..072d02a1aa8 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -113,9 +113,8 @@ You can also use transformers without creating a new custom form type by calling ``addModelTransformer`` (or ``addViewTransformer`` - see `Model and View Transformers`_) on any field builder:: - use Acme\TaskBundle\Form\DataTransformer\IssueToNumberTransformer; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Acme\TaskBundle\Form\DataTransformer\IssueToNumberTransformer; class TaskType extends AbstractType { @@ -134,7 +133,7 @@ by calling ``addModelTransformer`` (or ``addViewTransformer`` - see ); } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver ->setDefaults(array( @@ -255,7 +254,7 @@ First, create the custom field type class:: use Symfony\Component\Form\FormBuilderInterface; use Acme\TaskBundle\Form\DataTransformer\IssueToNumberTransformer; use Doctrine\Common\Persistence\ObjectManager; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class IssueSelectorType extends AbstractType { @@ -278,7 +277,7 @@ First, create the custom field type class:: $builder->addModelTransformer($transformer); } - public function configureOptions(OptionsResolverInterface $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'invalid_message' => 'The selected issue does not exist', diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 1a505876af5..faf2608b162 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -41,7 +41,7 @@ a bare form class looks like:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class ProductType extends AbstractType { @@ -51,7 +51,7 @@ a bare form class looks like:: $builder->add('price'); } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Product' @@ -224,6 +224,7 @@ Using an event listener, your form might look like this:: use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvent; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class FriendMessageFormType extends AbstractType { @@ -242,6 +243,10 @@ Using an event listener, your form might look like this:: { return 'friend_message'; } + + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + } } The problem is now to get the current user and create a choice field that diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index 50786a0773a..638a1dc2f49 100644 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -84,7 +84,7 @@ Then, create a form class so that a ``Tag`` object can be modified by the user:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class TagType extends AbstractType { @@ -93,7 +93,7 @@ Then, create a form class so that a ``Tag`` object can be modified by the user:: $builder->add('name'); } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Acme\TaskBundle\Entity\Tag', @@ -118,7 +118,7 @@ Notice that you embed a collection of ``TagType`` forms using the use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class TaskType extends AbstractType { @@ -129,7 +129,7 @@ Notice that you embed a collection of ``TagType`` forms using the $builder->add('tags', 'collection', array('type' => new TagType())); } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Acme\TaskBundle\Entity\Task', diff --git a/cookbook/form/inherit_data_option.rst b/cookbook/form/inherit_data_option.rst index 7429baae325..a4553f3847c 100644 --- a/cookbook/form/inherit_data_option.rst +++ b/cookbook/form/inherit_data_option.rst @@ -90,7 +90,7 @@ for that:: use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class LocationType extends AbstractType { @@ -103,7 +103,7 @@ for that:: ->add('country', 'text'); } - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'inherit_data' => true diff --git a/cookbook/form/use_empty_data.rst b/cookbook/form/use_empty_data.rst index 342341e5b7a..7bbe95b633a 100644 --- a/cookbook/form/use_empty_data.rst +++ b/cookbook/form/use_empty_data.rst @@ -41,7 +41,7 @@ that constructor with no arguments:: // ... use Symfony\Component\Form\AbstractType; use AppBundle\Entity\Blog; - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; class BlogType extends AbstractType { @@ -53,7 +53,7 @@ that constructor with no arguments:: } // ... - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'empty_data' => new Blog($this->someDependency), @@ -74,11 +74,11 @@ if it is needed. The closure must accept a ``FormInterface`` instance as the first argument:: - use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Form\FormInterface; // ... - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'empty_data' => function (FormInterface $form) { diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index 4f060e5988f..c2d88983a30 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -4,8 +4,8 @@ How to Use Monolog to Write Logs ================================ -Monolog_ is a logging library for PHP used by Symfony. It is inspired by the -Python LogBook library. +Monolog_ is a logging library for PHP 5.3 used by Symfony. It is +inspired by the Python LogBook library. Usage ----- diff --git a/cookbook/request/mime_type.rst b/cookbook/request/mime_type.rst index 269156654c3..adee071daed 100644 --- a/cookbook/request/mime_type.rst +++ b/cookbook/request/mime_type.rst @@ -15,6 +15,9 @@ object. Internally, Symfony contains a map of the most common formats (e.g. easily be added. This document will show how you can add the ``jsonp`` format and corresponding MIME type. +.. versionadded:: 2.5 + The possibility to configure request formats was introduced in Symfony 2.5. + Configure your New Format ------------------------- diff --git a/cookbook/security/_ircmaxwell_password-compat.rst.inc b/cookbook/security/_ircmaxwell_password-compat.rst.inc new file mode 100644 index 00000000000..3f96c454488 --- /dev/null +++ b/cookbook/security/_ircmaxwell_password-compat.rst.inc @@ -0,0 +1,13 @@ +.. caution:: + + If you're using PHP 5.4 or lower, you'll need to install the ``ircmaxell/password-compat`` + library via Composer in order to be able to use the ``bcrypt`` encoder: + + .. code-block:: json + + { + "require": { + ... + "ircmaxell/password-compat": "~1.0.3" + } + } diff --git a/cookbook/security/acl_advanced.rst b/cookbook/security/acl_advanced.rst index d4f18265d82..4d11081f4e5 100644 --- a/cookbook/security/acl_advanced.rst +++ b/cookbook/security/acl_advanced.rst @@ -45,6 +45,13 @@ Security Identities This is analog to the object identity, but represents a user, or a role in your application. Each role, or user has its own security identity. +.. versionadded:: 2.5 + For users, the security identity is based on the username. This means that, + if for any reason, a user's username was to change, you must ensure its + security identity is updated too. The + :method:`MutableAclProvider::updateUserSecurityIdentity() ` + method is there to handle the update, it was introduced in Symfony 2.5. + Database Table Structure ------------------------ diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 4ce9717eda8..54f5ec55acf 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -355,6 +355,8 @@ the database to be encoded using this encoder. For details on how to create a new User object with a properly encoded password, see the :ref:`book-security-encoding-user-password` section of the security chapter. +.. include:: /cookbook/security/_ircmaxwell_password-compat.rst.inc + The ``providers`` section defines an ``administrators`` user provider. A user provider is a "source" of where users are loaded during authentication. In this case, the ``entity`` keyword means that Symfony will use the Doctrine diff --git a/cookbook/security/firewall_restriction.rst b/cookbook/security/firewall_restriction.rst index 80e2bbc5212..306b6f5ef8f 100644 --- a/cookbook/security/firewall_restriction.rst +++ b/cookbook/security/firewall_restriction.rst @@ -131,6 +131,10 @@ request. Restricting by HTTP Methods --------------------------- +.. versionadded:: 2.5 + Support for restricting security firewalls to specific HTTP methods was introduced in + Symfony 2.5. + The configuration option ``methods`` restricts the initialization of the firewall to the provided HTTP methods. diff --git a/cookbook/security/named_encoders.rst b/cookbook/security/named_encoders.rst index 0cdd0b2eb7b..3b22a2d9343 100644 --- a/cookbook/security/named_encoders.rst +++ b/cookbook/security/named_encoders.rst @@ -4,6 +4,9 @@ How to Choose the Password Encoder Algorithm Dynamically ======================================================== +.. versionadded:: 2.5 + Named encoders were introduced in Symfony 2.5. + Usually, the same password encoder is used for all users by configuring it to apply to all instances of a specific class: diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index 96a0e4f45ec..ad112456d77 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -88,6 +88,11 @@ message as its argument and returns an instance of :class:`Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilderInterface`. The ``addViolation`` method call finally adds the violation to the context. +.. versionadded:: 2.5 + The ``buildViolation`` method was added in Symfony 2.5. For usage examples + with older Symfony versions, see the corresponding versions of this documentation + page. + Using the new Validator ----------------------- diff --git a/cookbook/web_server/built_in.rst b/cookbook/web_server/built_in.rst index c9293749f99..33289907614 100644 --- a/cookbook/web_server/built_in.rst +++ b/cookbook/web_server/built_in.rst @@ -8,10 +8,11 @@ How to Use PHP's built-in Web Server The ability to run the server as a background process was introduced in Symfony 2.6. -The CLI SAPI comes with a `built-in web server`_. It can be used to run your -PHP applications locally during development, for testing or for application -demonstrations. This way, you don't have to bother configuring a full-featured -web server such as :doc:`Apache or Nginx `. +Since PHP 5.4 the CLI SAPI comes with a `built-in web server`_. It can be used +to run your PHP applications locally during development, for testing or for +application demonstrations. This way, you don't have to bother configuring +a full-featured web server such as +:doc:`Apache or Nginx `. .. caution:: diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 1882e39ec5e..1dd9e8fa48a 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -8,9 +8,9 @@ by showing you a simple project in action. If you've used a web framework before, you should feel right at home with Symfony. If not, welcome to a whole new way of developing web applications. -The only technical requisite to follow this tutorial is to have **PHP 5.5.9 or higher +The only technical requisite to follow this tutorial is to have **PHP 5.4 or higher installed on your computer**. If you use a packaged PHP solution such as WAMP, -XAMP or MAMP, check out that they are using PHP 5.5.9 or a more recent version. +XAMP or MAMP, check out that they are using PHP 5.4 or a more recent version. You can also execute the following command in your terminal or command console to display the installed PHP version: diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 4643a72cff8..27497c810ed 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -641,7 +641,8 @@ API. The ``api`` option is used to switch between the different implementations: ``2.5-bc`` or ``auto`` If you omit a value or set the ``api`` option to ``2.5-bc`` or ``auto``, Symfony will use an API implementation that is compatible with both the - legacy implementation and the ``2.5`` implementation. + legacy implementation and the ``2.5`` implementation. You have to use + PHP 5.3.9 or higher to be able to use this implementation. To capture these logs in the ``prod`` environment, configure a :doc:`channel handler ` in ``config_prod.yml`` for diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index f0dfdba5421..8b8b204157b 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -129,6 +129,11 @@ those errors should be attributed:: } } +.. versionadded:: 2.5 + The ``buildViolation`` method was added in Symfony 2.5. For usage examples + with older Symfony versions, see the corresponding versions of this documentation + page. + Static Callbacks ---------------- diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 2a5b9ea2e6b..9df3332a749 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -90,6 +90,9 @@ Basic Usage Options ------- +.. versionadded:: 2.5 + The ``strict`` option was introduced in Symfony 2.5. + strict ~~~~~~ diff --git a/reference/constraints/Uuid.rst b/reference/constraints/Uuid.rst index ece78165716..4db4fc8ceab 100644 --- a/reference/constraints/Uuid.rst +++ b/reference/constraints/Uuid.rst @@ -1,6 +1,9 @@ Uuid ==== +.. versionadded:: 2.5 + The Uuid constraint was introduced in Symfony 2.5. + Validates that a value is a valid `Universally unique identifier (UUID)`_ per `RFC 4122`_. By default, this will validate the format according to the RFC's guidelines, but this can be relaxed to accept non-standard UUIDs that other systems (like PostgreSQL) accept. diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index bfa2c3dc532..49b39581d12 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -293,7 +293,7 @@ the interface directly:: class MyFormTypeExtension extends AbstractTypeExtension { // ... fill in whatever methods you want to override - // like buildForm(), buildView(), finishView(), configureOptions() + // like buildForm(), buildView(), finishView(), setDefaultOptions() } In order for Symfony to know about your form extension and use it, give it diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index 367abb2eda1..2d21cf57a3a 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -259,6 +259,9 @@ For more information, see :ref:`cookbook-form-collections-remove`. delete_empty ~~~~~~~~~~~~ +.. versionadded:: 2.5 + The ``delete_empty`` option was introduced in Symfony 2.5. + **type**: ``Boolean`` **default**: ``false`` If you want to explicitly remove entirely empty collection entries from your diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst index d8f4228ee37..2449a4fdc92 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -86,6 +86,9 @@ Field Options multiple ~~~~~~~~ +.. versionadded:: 2.5 + The ``multiple`` option was introduced in Symfony 2.5. + **type**: ``Boolean`` **default**: ``false`` When set to true, the user will be able to upload multiple files at the same time. diff --git a/reference/forms/types/options/error_mapping.rst.inc b/reference/forms/types/options/error_mapping.rst.inc index 3159b562c66..7b3c1359871 100644 --- a/reference/forms/types/options/error_mapping.rst.inc +++ b/reference/forms/types/options/error_mapping.rst.inc @@ -13,7 +13,7 @@ of the form. With customized error mapping, you can do better: map the error to the city field so that it displays above it:: - public function configureOptions(OptionsResolver $resolver) + public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'error_mapping' => array( diff --git a/reference/requirements.rst b/reference/requirements.rst index 12c24d65e7a..5edc791f788 100644 --- a/reference/requirements.rst +++ b/reference/requirements.rst @@ -21,11 +21,17 @@ Below is the list of required and optional requirements. Required -------- -* PHP needs to be a minimum version of PHP 5.5.9 +* PHP needs to be a minimum version of PHP 5.3.3 * JSON needs to be enabled * ctype needs to be enabled * Your ``php.ini`` needs to have the ``date.timezone`` setting +.. caution:: + + Be aware that Symfony has some known limitations when using a PHP version + less than 5.3.8 or equal to 5.3.16. For more information see the + `Requirements section of the README`_. + Optional -------- @@ -50,3 +56,5 @@ Doctrine If you want to use Doctrine, you will need to have PDO installed. Additionally, you need to have the PDO driver installed for the database server you want to use. + +.. _`Requirements section of the README`: https://github.com/symfony/symfony#requirements diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index eaaa83f1ad1..e58eda4822a 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -355,44 +355,6 @@ Returns the absolute URL (with scheme and host) for the given route. If ``schemeRelative`` is enabled, it'll create a scheme-relative URL. More information in :ref:`book-templating-pages`. -absolute_url -~~~~~~~~~~~~ - -.. versionadded:: 2.6 - The ``absolute_url`` function was introduced in Symfony 2.7 - -.. code-block:: jinja - - {{ absolute_url(path) }} - -``path`` - **type**: ``string`` - -Returns the absolute URL for the given absolute path. This is useful to convert -an existing path: - -.. code-block:: jinja - - {{ absolute_url(asset(path)) }} - -relative_path -~~~~~~~~~~~~~ - -.. versionadded:: 2.6 - The ``relative_path`` function was introduced in Symfony 2.7 - -.. code-block:: jinja - - {{ relative_path(path) }} - -``path`` - **type**: ``string`` - -Returns a relative path for the given absolute path (based on the current -request path). For instance, if the current path is -``/article/news/welcome.html``, the relative path for ``/article/image.png`` is -``../images.png``. - expression ~~~~~~~~~~