diff --git a/best_practices/configuration.rst b/best_practices/configuration.rst index 136f8a3778c..b29b4a7b778 100644 --- a/best_practices/configuration.rst +++ b/best_practices/configuration.rst @@ -74,8 +74,8 @@ add an extra layer of configuration that's not needed because you don't need or want these configuration values to change on each server. The configuration options defined in the ``config.yml`` file usually vary from -one :doc:`/cookbook/configuration/environments` to another. That's why Symfony -already includes ``app/config/config_dev.yml`` and ``app/config/config_prod.yml`` +one :doc:`environment ` to another. That's +why Symfony already includes ``app/config/config_dev.yml`` and ``app/config/config_prod.yml`` files so that you can override specific values for each environment. Constants vs Configuration Options diff --git a/best_practices/controllers.rst b/best_practices/controllers.rst index 07bdf5ebb8e..31c4ae09438 100644 --- a/best_practices/controllers.rst +++ b/best_practices/controllers.rst @@ -139,7 +139,7 @@ For example: use AppBundle\Entity\Post; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; - + /** * @Route("/{id}", name="admin_post_show") */ @@ -212,6 +212,7 @@ Pre and Post Hooks ------------------ If you need to execute some code before or after the execution of your controllers, -you can use the EventDispatcher component to :doc:`/cookbook/event_dispatcher/before_after_filters`. +you can use the EventDispatcher component to +:doc:`set up before and after filters `. .. _`ParamConverter`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html diff --git a/best_practices/forms.rst b/best_practices/forms.rst index 897e4266468..d72d189ccfb 100644 --- a/best_practices/forms.rst +++ b/best_practices/forms.rst @@ -165,8 +165,9 @@ fields: If you need more control over how your fields are rendered, then you should remove the ``form_widget(form)`` function and render your fields individually. -See :doc:`/cookbook/form/form_customization` for more information on this and how -you can control *how* the form renders at a global level using form theming. +See the :doc:`/cookbook/form/form_customization` article for more information +on this and how you can control *how* the form renders at a global level +using form theming. Handling Form Submits --------------------- diff --git a/best_practices/security.rst b/best_practices/security.rst index 0fb274868d8..9d919385881 100644 --- a/best_practices/security.rst +++ b/best_practices/security.rst @@ -208,6 +208,8 @@ Now you can reuse this method both in the template and in the security expressio {% endif %} .. _best-practices-directly-isGranted: +.. _checking-permissions-without-security: +.. _manually-checking-permissions: Checking Permissions without @Security -------------------------------------- diff --git a/book/controller.rst b/book/controller.rst index c4b4b8d5cc1..6fa135ec9d5 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -683,9 +683,6 @@ content that's sent back to the client:: $response = new Response(json_encode(array('name' => $name))); $response->headers->set('Content-Type', 'application/json'); -.. versionadded:: 2.4 - Support for HTTP status code constants was introduced in Symfony 2.4. - The ``headers`` property is a :class:`Symfony\\Component\\HttpFoundation\\HeaderBag` object and has some nice methods for getting and setting the headers. The header names are normalized so that using ``Content-Type`` is equivalent to diff --git a/book/from_flat_php_to_symfony2.rst b/book/from_flat_php_to_symfony2.rst index e84ae383264..602161ab1f8 100644 --- a/book/from_flat_php_to_symfony2.rst +++ b/book/from_flat_php_to_symfony2.rst @@ -484,9 +484,6 @@ the HTTP response being returned. Use them to improve the blog: // echo the headers and send the response $response->send(); -.. versionadded:: 2.4 - Support for HTTP status code constants was introduced in Symfony 2.4. - The controllers are now responsible for returning a ``Response`` object. To make this easier, you can add a new ``render_template()`` function, which, incidentally, acts quite a bit like the Symfony templating engine: diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 4dcad9e4bbc..06532b8fcb2 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -287,9 +287,6 @@ interface to construct the response that needs to be returned to the client:: // prints the HTTP headers followed by the content $response->send(); -.. versionadded:: 2.4 - Support for HTTP status code constants was introduced in Symfony 2.4. - If Symfony offered nothing else, you would already have a toolkit for easily accessing request information and an object-oriented interface for creating the response. Even as you learn the many powerful features in Symfony, keep diff --git a/book/internals.rst b/book/internals.rst index 999e8ab40ec..e49b844635d 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -208,10 +208,6 @@ processing must only occur on the master request). Events ~~~~~~ -.. versionadded:: 2.4 - The ``isMasterRequest()`` method was introduced in Symfony 2.4. - Prior, the ``getRequestType()`` method must be used. - Each event thrown by the Kernel is a subclass of :class:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent`. This means that each event has access to the same basic information: diff --git a/book/routing.rst b/book/routing.rst index 8e1887a5290..d5a13c8ce01 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -644,7 +644,7 @@ be added for each parameter. For example: .. configuration-block:: - .. code-block:: php + .. code-block:: php-annotations // src/AppBundle/Controller/BlogController.php @@ -915,9 +915,6 @@ component documentation. Completely Customized Route Matching with Conditions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 2.4 - Route conditions were introduced in Symfony 2.4. - As you've seen, a route can be made to match only certain routing wildcards (via regular expressions), HTTP methods, or host names. But the routing system can be extended to have an almost infinite flexibility using ``conditions``: diff --git a/book/security.rst b/book/security.rst index 731d2a4e9d6..447480e5f97 100644 --- a/book/security.rst +++ b/book/security.rst @@ -5,7 +5,7 @@ Security ======== Symfony's security system is incredibly powerful, but it can also be confusing -to setup. In this chapter, you'll learn how to setup your application's security +to set up. In this chapter, you'll learn how to set up your application's security step-by-step, from configuring your firewall and how you load users to denying access and fetching the User object. Depending on what you need, sometimes the initial setup can be tough. But once it's done, Symfony's security system @@ -300,7 +300,7 @@ provider, but it's better to think of it as an "in configuration" provider: memory: users: ryan: - password: ryanpass, + password: ryanpass roles: 'ROLE_USER' admin: password: kitten @@ -808,9 +808,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. @@ -925,9 +922,6 @@ special attributes like this: .. _book-security-template-expression: -.. versionadded:: 2.4 - The ``expression`` functionality was introduced in Symfony 2.4. - You can also use expressions inside your templates: .. configuration-block:: @@ -1304,11 +1298,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/service_container.rst b/book/service_container.rst index a24f2484d2c..fd79558dd56 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -624,9 +624,6 @@ the work of instantiating the classes. Using the Expression Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 2.4 - The Expression Language functionality was introduced in Symfony 2.4. - The service container also supports an "expression" that allows you to inject very specific values into a service. @@ -818,9 +815,6 @@ Injecting the dependency by the setter method just needs a change of syntax: Injecting the Request ~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 2.4 - The ``request_stack`` service was introduced in Symfony 2.4. - As of Symfony 2.4, instead of injecting the ``request`` service, you should inject the ``request_stack`` service and access the ``Request`` by calling the :method:`Symfony\\Component\\HttpFoundation\\RequestStack::getCurrentRequest` diff --git a/book/templating.rst b/book/templating.rst index 813409a71d2..9cca58dfa9b 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: @@ -1046,9 +1043,6 @@ 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/testing.rst b/book/testing.rst index bf69da90f0a..6fe411aff7a 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -17,8 +17,8 @@ it has its own excellent `documentation`_. .. note:: - Symfony works with PHPUnit 3.5.11 or later, though version 3.6.4 is - needed to test the Symfony core code itself. + It's recommended to use the latest stable PHPUnit version (you will have + to use version 4.2 or higher to test the Symfony core code itself). Each test - whether it's a unit test or a functional test - is a PHP class that should live in the ``Tests/`` subdirectory of your bundles. If you follow diff --git a/book/translation.rst b/book/translation.rst index b52ce67c91c..47ea5ae40ea 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -670,9 +670,6 @@ 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 8d34630e04d..4086f01c02c 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/debug_class_loader.rst b/components/class_loader/debug_class_loader.rst index c56d7ffe095..75bf66c707a 100644 --- a/components/class_loader/debug_class_loader.rst +++ b/components/class_loader/debug_class_loader.rst @@ -1,9 +1,11 @@ .. index:: single: ClassLoader; DebugClassLoader - + Debugging a Class Loader ======================== -Since Symfony 2.4, the ``DebugClassLoader`` of the Class Loader component is -deprecated. Use the -:doc:`DebugClassLoader provided by the Debug component `. +.. caution:: + + The ``DebugClassLoader`` from the ClassLoader component was deprecated + in Symfony 2.5 and will be removed in Symfony 3.0. Use the + :doc:`DebugClassLoader provided by the Debug component `. diff --git a/components/class_loader/psr4_class_loader.rst b/components/class_loader/psr4_class_loader.rst index 33915b16a9e..b593e174027 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/debug_formatter.rst b/components/console/helpers/debug_formatter.rst index 6368686b78d..33b054bd726 100644 --- a/components/console/helpers/debug_formatter.rst +++ b/components/console/helpers/debug_formatter.rst @@ -9,14 +9,23 @@ Debug Formatter Helper The :class:`Symfony\\Component\\Console\\Helper\\DebugFormatterHelper` provides functions to output debug information when running an external program, for -instance a process or HTTP request. It is included in the default helper set -and you can get it by calling -:method:`Symfony\\Component\\Console\\Command\\Command::getHelper`:: +instance a process or HTTP request. For example, if you used it to output +the results of running ``ls -la`` on a UNIX system, it might output something +like this: + +.. image:: /images/components/console/debug_formatter.png + :align: center + +Using the debug_formatter +------------------------- + +The formatter is included in the default helper set and you can get it by +calling :method:`Symfony\\Component\\Console\\Command\\Command::getHelper`:: $debugFormatter = $this->getHelper('debug_formatter'); -The formatter only formats strings, which you can use to output to the console, -but also to log the information or do anything else. +The formatter accepts strings and returns a formatted string, which you then +output to the console (or even log the information or do anything else). All methods of this helper have an identifier as the first argument. This is a unique value for each program. This way, the helper can debug information for @@ -39,9 +48,13 @@ display information that the program is started:: // ... $process = new Process(...); - $process->run(); - $output->writeln($debugFormatter->start(spl_object_hash($process), 'Some process description')); + $output->writeln($debugFormatter->start( + spl_object_hash($process), + 'Some process description') + ); + + $process->run(); This will output: @@ -51,7 +64,11 @@ This will output: You can tweak the prefix using the third argument:: - $output->writeln($debugFormatter->start(spl_object_hash($process), 'Some process description', 'STARTED'); + $output->writeln($debugFormatter->start( + spl_object_hash($process), + 'Some process description', + 'STARTED' + ); // will output: // STARTED Some process description @@ -69,7 +86,11 @@ using $process->run(function ($type, $buffer) use ($output, $debugFormatter, $process) { $output->writeln( - $debugFormatter->progress(spl_object_hash($process), $buffer, Process::ERR === $type) + $debugFormatter->progress( + spl_object_hash($process), + $buffer, + Process::ERR === $type + ) ); }); // ... diff --git a/components/console/helpers/map.rst.inc b/components/console/helpers/map.rst.inc index f1794ef3d5e..d0913db4033 100644 --- a/components/console/helpers/map.rst.inc +++ b/components/console/helpers/map.rst.inc @@ -1,9 +1,9 @@ -* :doc:`/components/console/helpers/dialoghelper` +* :doc:`/components/console/helpers/dialoghelper` (deprecated as of 2.5) * :doc:`/components/console/helpers/formatterhelper` * :doc:`/components/console/helpers/processhelper` * :doc:`/components/console/helpers/progressbar` -* :doc:`/components/console/helpers/progresshelper` +* :doc:`/components/console/helpers/progresshelper` (deprecated as of 2.5) * :doc:`/components/console/helpers/questionhelper` * :doc:`/components/console/helpers/table` -* :doc:`/components/console/helpers/tablehelper` +* :doc:`/components/console/helpers/tablehelper` (deprecated as of 2.5) * :doc:`/components/console/helpers/debug_formatter` (new in 2.6) 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/progresshelper.rst b/components/console/helpers/progresshelper.rst index 78e09e0eb25..7d858d21691 100644 --- a/components/console/helpers/progresshelper.rst +++ b/components/console/helpers/progresshelper.rst @@ -7,9 +7,6 @@ Progress Helper .. versionadded:: 2.3 The ``setCurrent`` method was introduced in Symfony 2.3. -.. versionadded:: 2.4 - The ``clear`` method was introduced in Symfony 2.4. - .. caution:: The Progress Helper was deprecated in Symfony 2.5 and will be removed in 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/helpers/tablehelper.rst b/components/console/helpers/tablehelper.rst index d1c094938cf..0e508b4d4d6 100644 --- a/components/console/helpers/tablehelper.rst +++ b/components/console/helpers/tablehelper.rst @@ -39,9 +39,6 @@ table rendering: using named layouts or by customizing rendering options. Customize Table Layout using Named Layouts ------------------------------------------ -.. versionadded:: 2.4 - The ``TableHelper::LAYOUT_COMPACT`` layout was introduced in Symfony 2.4. - The Table helper ships with three preconfigured table layouts: * ``TableHelper::LAYOUT_DEFAULT`` diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 46c728b07da..34d02287061 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -203,13 +203,6 @@ level. For example:: $output->writeln(...); } -.. versionadded:: 2.4 - The :method:`Symfony\\Component\\Console\\Output\\Output::isQuiet`, - :method:`Symfony\\Component\\Console\\Output\\Output::isVerbose`, - :method:`Symfony\\Component\\Console\\Output\\Output::isVeryVerbose` and - :method:`Symfony\\Component\\Console\\Output\\Output::isDebug` - methods were introduced in Symfony 2.4 - There are also more semantic methods you can use to test for each of the verbosity levels:: @@ -409,9 +402,9 @@ tools capable of helping you with different tasks: * :doc:`/components/console/helpers/questionhelper`: interactively ask the user for information * :doc:`/components/console/helpers/formatterhelper`: customize the output colorization -* :doc:`/components/console/helpers/progresshelper`: shows a progress bar -* :doc:`/components/console/helpers/tablehelper`: displays tabular data as a table -* :doc:`/components/console/helpers/dialoghelper`: (deprecated) interactively ask the user for information +* :doc:`/components/console/helpers/progressbar`: shows a progress bar +* :doc:`/components/console/helpers/table`: displays tabular data as a table +* :doc:`/components/console/helpers/questionhelper`: interactively ask the user for information .. _component-console-testing-commands: 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/debug/class_loader.rst b/components/debug/class_loader.rst index 34a06bce3e7..7966095b005 100644 --- a/components/debug/class_loader.rst +++ b/components/debug/class_loader.rst @@ -5,10 +5,6 @@ Debugging a Class Loader ======================== -.. versionadded:: 2.4 - The ``DebugClassLoader`` of the Debug component was introduced in Symfony 2.4. - Previously, it was located in the ClassLoader component. - The :class:`Symfony\\Component\\Debug\\DebugClassLoader` attempts to throw more helpful exceptions when a class isn't found by the registered autoloaders. All autoloaders that implement a ``findFile()`` method are replaced diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 43726d393cb..0145591d480 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -227,9 +227,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/dom_crawler.rst b/components/dom_crawler.rst index 37ef6e24827..c9809e28331 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -102,10 +102,6 @@ Both the :method:`Symfony\\Component\\DomCrawler\\Crawler::filterXPath` and XML namespaces, which can be either automatically discovered or registered explicitly. -.. versionadded:: 2.4 - Auto discovery and explicit registration of namespaces was introduced - in Symfony 2.4. - Consider the XML below: .. code-block:: xml @@ -456,10 +452,6 @@ directly:: Selecting Invalid Choice Values ............................... -.. versionadded:: 2.4 - The :method:`Symfony\\Component\\DomCrawler\\Form::disableValidation` - method was introduced in Symfony 2.4. - By default, choice fields (select, radio) have internal validation activated to prevent you from setting invalid values. If you want to be able to set invalid values, you can use the ``disableValidation()`` method on either diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index 44db477789b..813b3c1ff9e 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -489,10 +489,6 @@ which returns a boolean value:: EventDispatcher aware Events and Listeners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 2.4 - Since Symfony 2.4, the current event name and the ``EventDispatcher`` - itself are passed to the listeners as additional arguments. - The ``EventDispatcher`` always passes the dispatched event, the event's name and a reference to itself to the listeners. This can be used in some advanced usages of the ``EventDispatcher`` like dispatching other events in listeners, 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/expression_language/introduction.rst b/components/expression_language/introduction.rst index a53c8aa960d..b14e37d5504 100644 --- a/components/expression_language/introduction.rst +++ b/components/expression_language/introduction.rst @@ -9,9 +9,6 @@ The ExpressionLanguage Component evaluate expressions. An expression is a one-liner that returns a value (mostly, but not limited to, Booleans). -.. versionadded:: 2.4 - The ExpressionLanguage component was introduced in Symfony 2.4. - Installation ------------ diff --git a/components/filesystem/introduction.rst b/components/filesystem/introduction.rst index 9f58e450300..66e93c51263 100644 --- a/components/filesystem/introduction.rst +++ b/components/filesystem/introduction.rst @@ -36,10 +36,6 @@ endpoint for filesystem operations:: echo "An error occurred while creating your directory at ".$e->getPath(); } -.. versionadded:: 2.4 - The ``IOExceptionInterface`` and its ``getPath`` method were introduced in - Symfony 2.4. Prior to 2.4, you would catch the ``IOException`` class. - .. note:: Methods :method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir`, 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/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 9a5edd7d495..e3e0a3c4ed8 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -284,10 +284,6 @@ for more information about them. Overriding the Request ~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 2.4 - The :method:`Symfony\\Component\\HttpFoundation\\Request::setFactory` - method was introduced in Symfony 2.4. - The ``Request`` class should not be overridden as it is a data object that represents an HTTP message. But when moving from a legacy system, adding methods or changing some default behavior might help. In that case, register a @@ -335,9 +331,6 @@ code, and an array of HTTP headers:: array('content-type' => 'text/html') ); -.. versionadded:: 2.4 - Support for HTTP status code constants was introduced in Symfony 2.4. - These information can also be manipulated after the Response object creation:: $response->setContent('Hello World'); diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 074994a58f5..10bec26f314 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -495,10 +495,9 @@ as possible to the client (e.g. sending emails). .. sidebar:: ``kernel.terminate`` in the Symfony Framework - If you use the SwiftmailerBundle with Symfony and use ``memory`` - spooling, then the :class:`Symfony\\Bundle\\SwiftmailerBundle\\EventListener\\EmailSenderListener` - is activated, which actually delivers any emails that you scheduled to - send during the request. + If you use the SwiftmailerBundle with Symfony and use ``memory`` spooling, + then the `EmailSenderListener`_ is activated, which actually delivers + any emails that you scheduled to send during the request. .. _component-http-kernel-kernel-exception: @@ -680,10 +679,6 @@ argument as follows:: $response = $kernel->handle($request, HttpKernelInterface::SUB_REQUEST); // do something with this response -.. versionadded:: 2.4 - The ``isMasterRequest()`` method was introduced in Symfony 2.4. - Prior, the ``getRequestType()`` method must be used. - This creates another full request-response cycle where this new ``Request`` is transformed into a ``Response``. The only difference internally is that some listeners (e.g. security) may only act upon the master request. Each listener @@ -714,3 +709,4 @@ look like this:: .. _`SensioFrameworkExtraBundle`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html .. _`@ParamConverter`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html .. _`@Template`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/view.html +.. _`EmailSenderListener`: https://github.com/symfony/SwiftmailerBundle/blob/master/EventListener/EmailSenderListener.php diff --git a/components/process.rst b/components/process.rst index ef77f6078da..67c14b80544 100644 --- a/components/process.rst +++ b/components/process.rst @@ -42,17 +42,11 @@ output. Alternatively, the :method:`Symfony\\Component\\Process\\Process::getInc and :method:`Symfony\\Component\\Process\\Process::getIncrementalErrorOutput` methods returns the new outputs since the last call. -.. versionadded:: 2.4 - The ``clearOutput()`` and ``clearErrorOutput()`` methods were introduced in Symfony 2.4. - The :method:`Symfony\\Component\\Process\\Process::clearOutput` method clears 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 @@ -236,10 +230,6 @@ check regularly:: Process Idle Timeout -------------------- -.. versionadded:: 2.4 - The :method:`Symfony\\Component\\Process\\Process::setIdleTimeout` method - was introduced in Symfony 2.4. - In contrast to the timeout of the previous paragraph, the idle timeout only considers the time since the last output was produced by the process:: @@ -306,11 +296,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 96a6ea60f71..534d2303692 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 112a24a197e..9f727f602e8 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/components/translation/introduction.rst b/components/translation/introduction.rst index cbdb6840e26..c8130e6f7ec 100644 --- a/components/translation/introduction.rst +++ b/components/translation/introduction.rst @@ -62,9 +62,6 @@ The Translation component uses Loader classes to load catalogs. You can load multiple resources for the same locale, which will then be combined into one catalog. -.. versionadded:: 2.4 - The ``JsonFileLoader`` was introduced in Symfony 2.4. - The component comes with some default Loaders and you can create your own Loader too. The default loaders are: diff --git a/cookbook/assetic/apply_to_option.rst b/cookbook/assetic/apply_to_option.rst index 8d5cf98fac8..4c080691f03 100644 --- a/cookbook/assetic/apply_to_option.rst +++ b/cookbook/assetic/apply_to_option.rst @@ -59,14 +59,14 @@ templates: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/example.coffee' filter='coffee' %} + {% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/example.coffee'), + array('@AppBundle/Resources/public/js/example.coffee'), array('coffee') ) as $url): ?> @@ -84,8 +84,8 @@ You can also combine multiple CoffeeScript files into a single output file: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/example.coffee' - '@AcmeFooBundle/Resources/public/js/another.coffee' + {% javascripts '@AppBundle/Resources/public/js/example.coffee' + '@AppBundle/Resources/public/js/another.coffee' filter='coffee' %} {% endjavascripts %} @@ -94,8 +94,8 @@ You can also combine multiple CoffeeScript files into a single output file: javascripts( array( - '@AcmeFooBundle/Resources/public/js/example.coffee', - '@AcmeFooBundle/Resources/public/js/another.coffee', + '@AppBundle/Resources/public/js/example.coffee', + '@AppBundle/Resources/public/js/another.coffee', ), array('coffee') ) as $url): ?> @@ -170,9 +170,9 @@ being run through the CoffeeScript filter): .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/example.coffee' - '@AcmeFooBundle/Resources/public/js/another.coffee' - '@AcmeFooBundle/Resources/public/js/regular.js' %} + {% javascripts '@AppBundle/Resources/public/js/example.coffee' + '@AppBundle/Resources/public/js/another.coffee' + '@AppBundle/Resources/public/js/regular.js' %} {% endjavascripts %} @@ -180,9 +180,9 @@ being run through the CoffeeScript filter): javascripts( array( - '@AcmeFooBundle/Resources/public/js/example.coffee', - '@AcmeFooBundle/Resources/public/js/another.coffee', - '@AcmeFooBundle/Resources/public/js/regular.js', + '@AppBundle/Resources/public/js/example.coffee', + '@AppBundle/Resources/public/js/another.coffee', + '@AppBundle/Resources/public/js/regular.js', ) ) as $url): ?> diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst index 6743796edba..785e239b1a0 100644 --- a/cookbook/assetic/asset_management.rst +++ b/cookbook/assetic/asset_management.rst @@ -59,14 +59,14 @@ To include JavaScript files, use the ``javascripts`` tag in any template: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' %} + {% javascripts '@AppBundle/Resources/public/js/*' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*') + array('@AppBundle/Resources/public/js/*') ) as $url): ?> @@ -81,7 +81,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template: {# ... #} {% block javascripts %} - {% javascripts '@AcmeFooBundle/Resources/public/js/*' %} + {% javascripts '@AppBundle/Resources/public/js/*' %} {% endjavascripts %} {% endblock %} @@ -92,7 +92,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template: You can also include CSS Stylesheets: see :ref:`cookbook-assetic-including-css`. In this example, all of the files in the ``Resources/public/js/`` directory -of the ``AcmeFooBundle`` will be loaded and served from a different location. +of the ``AppBundle`` will be loaded and served from a different location. The actual rendered tag might simply look like: .. code-block:: html @@ -115,14 +115,14 @@ above, except with the ``stylesheets`` tag: .. code-block:: html+jinja - {% stylesheets 'bundles/acme_foo/css/*' filter='cssrewrite' %} + {% stylesheets 'bundles/app/css/*' filter='cssrewrite' %} {% endstylesheets %} .. code-block:: html+php stylesheets( - array('bundles/acme_foo/css/*'), + array('bundles/app/css/*'), array('cssrewrite') ) as $url): ?> @@ -138,7 +138,7 @@ above, except with the ``stylesheets`` tag: {# ... #} {% block stylesheets %} - {% stylesheets 'bundles/acme_foo/css/*' filter='cssrewrite' %} + {% stylesheets 'bundles/app/css/*' filter='cssrewrite' %} {% endstylesheets %} {% endblock %} @@ -151,11 +151,11 @@ the :ref:`cssrewrite ` filter. .. note:: Notice that in the original example that included JavaScript files, you - referred to the files using a path like ``@AcmeFooBundle/Resources/public/file.js``, + referred to the files using a path like ``@AppBundle/Resources/public/file.js``, but that in this example, you referred to the CSS files using their actual, - publicly-accessible path: ``bundles/acme_foo/css``. You can use either, except + publicly-accessible path: ``bundles/app/css``. You can use either, except that there is a known issue that causes the ``cssrewrite`` filter to fail - when using the ``@AcmeFooBundle`` syntax for CSS Stylesheets. + when using the ``@AppBundle`` syntax for CSS Stylesheets. .. _cookbook-assetic-including-image: @@ -168,14 +168,14 @@ To include an image you can use the ``image`` tag. .. code-block:: html+jinja - {% image '@AcmeFooBundle/Resources/public/images/example.jpg' %} + {% image '@AppBundle/Resources/public/images/example.jpg' %} Example {% endimage %} .. code-block:: html+php image( - array('@AcmeFooBundle/Resources/public/images/example.jpg') + array('@AppBundle/Resources/public/images/example.jpg') ) as $url): ?> Example @@ -198,7 +198,7 @@ You can see an example in the previous section. .. caution:: When using the ``cssrewrite`` filter, don't refer to your CSS files using - the ``@AcmeFooBundle`` syntax. See the note in the above section for details. + the ``@AppBundle`` syntax. See the note in the above section for details. Combining Assets ~~~~~~~~~~~~~~~~ @@ -215,7 +215,7 @@ but still serve them as a single file: .. code-block:: html+jinja {% javascripts - '@AcmeFooBundle/Resources/public/js/*' + '@AppBundle/Resources/public/js/*' '@AcmeBarBundle/Resources/public/js/form.js' '@AcmeBarBundle/Resources/public/js/calendar.js' %} @@ -225,7 +225,7 @@ but still serve them as a single file: javascripts( array( - '@AcmeFooBundle/Resources/public/js/*', + '@AppBundle/Resources/public/js/*', '@AcmeBarBundle/Resources/public/js/form.js', '@AcmeBarBundle/Resources/public/js/calendar.js', ) @@ -254,8 +254,8 @@ combine third party assets, such as jQuery, with your own into a single file: .. code-block:: html+jinja {% javascripts - '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js' - '@AcmeFooBundle/Resources/public/js/*' %} + '@AppBundle/Resources/public/js/thirdparty/jquery.js' + '@AppBundle/Resources/public/js/*' %} {% endjavascripts %} @@ -263,8 +263,8 @@ combine third party assets, such as jQuery, with your own into a single file: javascripts( array( - '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js', - '@AcmeFooBundle/Resources/public/js/*', + '@AppBundle/Resources/public/js/thirdparty/jquery.js', + '@AppBundle/Resources/public/js/*', ) ) as $url): ?> @@ -287,8 +287,8 @@ configuration under the ``assetic`` section. Read more in the assets: jquery_and_ui: inputs: - - '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js' - - '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.ui.js' + - '@AppBundle/Resources/public/js/thirdparty/jquery.js' + - '@AppBundle/Resources/public/js/thirdparty/jquery.ui.js' .. code-block:: xml @@ -299,8 +299,8 @@ configuration under the ``assetic`` section. Read more in the - @AcmeFooBundle/Resources/public/js/thirdparty/jquery.js - @AcmeFooBundle/Resources/public/js/thirdparty/jquery.ui.js + @AppBundle/Resources/public/js/thirdparty/jquery.js + @AppBundle/Resources/public/js/thirdparty/jquery.ui.js @@ -312,8 +312,8 @@ configuration under the ``assetic`` section. Read more in the 'assets' => array( 'jquery_and_ui' => array( 'inputs' => array( - '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js', - '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.ui.js', + '@AppBundle/Resources/public/js/thirdparty/jquery.js', + '@AppBundle/Resources/public/js/thirdparty/jquery.ui.js', ), ), ), @@ -328,7 +328,7 @@ with the ``@named_asset`` notation: {% javascripts '@jquery_and_ui' - '@AcmeFooBundle/Resources/public/js/*' %} + '@AppBundle/Resources/public/js/*' %} {% endjavascripts %} @@ -337,7 +337,7 @@ with the ``@named_asset`` notation: javascripts( array( '@jquery_and_ui', - '@AcmeFooBundle/Resources/public/js/*', + '@AppBundle/Resources/public/js/*', ) ) as $url): ?> @@ -406,14 +406,14 @@ into your template: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='uglifyjs2' %} + {% javascripts '@AppBundle/Resources/public/js/*' filter='uglifyjs2' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*'), + array('@AppBundle/Resources/public/js/*'), array('uglifyjs2') ) as $url): ?> @@ -432,14 +432,14 @@ done from the template and is relative to the public document root: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' output='js/compiled/main.js' %} + {% javascripts '@AppBundle/Resources/public/js/*' output='js/compiled/main.js' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*'), + array('@AppBundle/Resources/public/js/*'), array(), array('output' => 'js/compiled/main.js') ) as $url): ?> @@ -555,14 +555,14 @@ some isolated directory (e.g. ``/js/compiled``), to keep things organized: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' output='js/compiled/main.js' %} + {% javascripts '@AppBundle/Resources/public/js/*' output='js/compiled/main.js' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*'), + array('@AppBundle/Resources/public/js/*'), array(), array('output' => 'js/compiled/main.js') ) as $url): ?> diff --git a/cookbook/assetic/jpeg_optimize.rst b/cookbook/assetic/jpeg_optimize.rst index 01f67f6ebcb..7955771ca02 100644 --- a/cookbook/assetic/jpeg_optimize.rst +++ b/cookbook/assetic/jpeg_optimize.rst @@ -57,7 +57,7 @@ It can now be used from a template: .. code-block:: html+jinja - {% image '@AcmeFooBundle/Resources/public/images/example.jpg' + {% image '@AppBundle/Resources/public/images/example.jpg' filter='jpegoptim' output='/images/example.jpg' %} Example {% endimage %} @@ -65,7 +65,7 @@ It can now be used from a template: .. code-block:: html+php image( - array('@AcmeFooBundle/Resources/public/images/example.jpg'), + array('@AppBundle/Resources/public/images/example.jpg'), array('jpegoptim') ) as $url): ?> Example @@ -204,7 +204,7 @@ The Twig template can now be changed to the following: .. code-block:: html+jinja - Example + Example You can specify the output directory in the config in the following way: diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 958a1c616a5..a028c50e7b7 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -161,14 +161,14 @@ your assets are a part of the view layer, this work is done in your templates: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='uglifyjs2' %} + {% javascripts '@AppBundle/Resources/public/js/*' filter='uglifyjs2' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*'), + array('@AppBundle/Resources/public/js/*'), array('uglifyj2s') ) as $url): ?> @@ -176,7 +176,7 @@ your assets are a part of the view layer, this work is done in your templates: .. note:: - The above example assumes that you have a bundle called ``AcmeFooBundle`` + The above example assumes that you have a bundle called ``AppBundle`` and your JavaScript files are in the ``Resources/public/js`` directory under your bundle. This isn't important however - you can include your JavaScript files no matter where they are. @@ -197,14 +197,14 @@ apply this filter when debug mode is off (e.g. ``app.php``): .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='?uglifyjs2' %} + {% javascripts '@AppBundle/Resources/public/js/*' filter='?uglifyjs2' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*'), + array('@AppBundle/Resources/public/js/*'), array('?uglifyjs2') ) as $url): ?> @@ -272,14 +272,14 @@ helper: .. code-block:: html+jinja - {% stylesheets 'bundles/AcmeFoo/css/*' filter='uglifycss' filter='cssrewrite' %} + {% stylesheets 'bundles/App/css/*' filter='uglifycss' filter='cssrewrite' %} {% endstylesheets %} .. code-block:: html+php stylesheets( - array('bundles/AcmeFoo/css/*'), + array('bundles/App/css/*'), array('uglifycss'), array('cssrewrite') ) as $url): ?> diff --git a/cookbook/assetic/yuicompressor.rst b/cookbook/assetic/yuicompressor.rst index fedd4dab1da..7e3671fa2fb 100644 --- a/cookbook/assetic/yuicompressor.rst +++ b/cookbook/assetic/yuicompressor.rst @@ -91,14 +91,14 @@ the view layer, this work is done in your templates: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='yui_js' %} + {% javascripts '@AppBundle/Resources/public/js/*' filter='yui_js' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*'), + array('@AppBundle/Resources/public/js/*'), array('yui_js') ) as $url): ?> @@ -106,7 +106,7 @@ the view layer, this work is done in your templates: .. note:: - The above example assumes that you have a bundle called ``AcmeFooBundle`` + The above example assumes that you have a bundle called ``AppBundle`` and your JavaScript files are in the ``Resources/public/js`` directory under your bundle. This isn't important however - you can include your JavaScript files no matter where they are. @@ -119,14 +119,14 @@ can be repeated to minify your stylesheets. .. code-block:: html+jinja - {% stylesheets '@AcmeFooBundle/Resources/public/css/*' filter='yui_css' %} + {% stylesheets '@AppBundle/Resources/public/css/*' filter='yui_css' %} {% endstylesheets %} .. code-block:: html+php stylesheets( - array('@AcmeFooBundle/Resources/public/css/*'), + array('@AppBundle/Resources/public/css/*'), array('yui_css') ) as $url): ?> @@ -145,14 +145,14 @@ apply this filter when debug mode is off. .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='?yui_js' %} + {% javascripts '@AppBundle/Resources/public/js/*' filter='?yui_js' %} {% endjavascripts %} .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*'), + array('@AppBundle/Resources/public/js/*'), array('?yui_js') ) as $url): ?> diff --git a/cookbook/bundles/best_practices.rst b/cookbook/bundles/best_practices.rst index 5beb13fd741..abce460c45f 100644 --- a/cookbook/bundles/best_practices.rst +++ b/cookbook/bundles/best_practices.rst @@ -368,8 +368,8 @@ API is being used. The following code, would work for *all* users:: // the 2.5 API $this->context->buildViolation($constraint->message) ->setParameter('%string%', $value) - ->addViolation(); - ); + ->addViolation() + ; } else { // the 2.4 API $this->context->addViolation( diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index d335b8a3f26..bdaf74570a6 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -23,8 +23,9 @@ following conventions: * It has to live in the ``DependencyInjection`` namespace of the bundle; * The name is equal to the bundle name with the ``Bundle`` suffix replaced by - ``Extension`` (e.g. the Extension class of ``AcmeHelloBundle`` would be - called ``AcmeHelloExtension``). + ``Extension`` (e.g. the Extension class of ``AppBundle`` would be called + ``AppExtension`` and the one for ``AcmeHelloBundle`` would be called + ``AcmeHelloExtension``). The Extension class should implement the :class:`Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface`, diff --git a/cookbook/cache/form_csrf_caching.rst b/cookbook/cache/form_csrf_caching.rst index 9e22ff6d4e7..74d4c5854e7 100644 --- a/cookbook/cache/form_csrf_caching.rst +++ b/cookbook/cache/form_csrf_caching.rst @@ -10,39 +10,33 @@ need to be cautious if you try to cache pages with forms including them. For more information about how CSRF protection works in Symfony, please check :ref:`CSRF Protection `. -Why Reverse Proxy Caches do not Cache these Pages by Default ------------------------------------------------------------- - -There are many ways to generate unique tokens for each user but in order get -them validated when the form is submitted, you need to store them inside the -PHP Session. - -If you are using Varnish or some similar reverse proxy cache and you try to cache -pages containing forms with CSRF token protection, you will see that, by default, -the reverse proxy cache refuses to cache. - -This happens because a cookie is sent in order to preserve the PHP session open and -Varnish default behaviour is to not cache HTTP requests with cookies. - -If you think about it, if you managed to cache the form you would end up -with many users getting the same token in the form generation. When these -users try to send the form to the server, the CSRF validation will fail for -them because the expected token is stored in their session and different -for each user. - -How to Cache Most of the Page and still Be Able to Use CSRF Protection +Why Caching Pages with a CSRF token is Problematic +-------------------------------------------------- + +Typically, each user is assigned a unique CSRF token, which is stored in +the session for validation. This means that if you *do* cache a page with +a form containing a CSRF token, you'll cache the CSRF token of the *first* +user only. When a user submits the form, the token won't match the token +stored in the session and all users (except for the first) will fail CSRF +validation when submitting the form. + +In fact, many reverse proxies (like Varnish) will refuse to cache a page +with a CSRF token. This is because a cookie is sent in order to preserve +the PHP session open and Varnish's default behaviour is to not cache HTTP +requests with cookies. + +How to Cache Most of the Page and still be able to Use CSRF Protection ---------------------------------------------------------------------- -To cache a page that contains a CSRF token you can use more advanced caching -techniques like `ESI`_ fragments, having a TTL for the full page and embedding -the form inside an ESI tag with no cache at all. +To cache a page that contains a CSRF token, you can use more advanced caching +techniques like :ref:`ESI fragments `, where you cache +the full page and embedding the form inside an ESI tag with no cache at all. -Another option to be able to cache that heavy page would be loading the form -via an uncached AJAX request but cache the rest of the HTML response. +Another option would be to load the form via an uncached AJAX request, but +cache the rest of the HTML response. Or you can even load just the CSRF token with an AJAX request and replace the form field value with it. .. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery -.. _`ESI`: http://www.w3.org/TR/esi-lang .. _`Security CSRF Component`: https://github.com/symfony/security-csrf \ No newline at end of file diff --git a/cookbook/configuration/apache_router.rst b/cookbook/configuration/apache_router.rst index 4129e507eeb..f77b3d6e7e9 100644 --- a/cookbook/configuration/apache_router.rst +++ b/cookbook/configuration/apache_router.rst @@ -59,7 +59,7 @@ Symfony to use the ``ApacheUrlMatcher`` instead of the default one: Generating mod_rewrite Rules ---------------------------- -To test that it's working, create a very basic route for the AcmeDemoBundle: +To test that it's working, create a very basic route for the AppBundle: .. configuration-block:: @@ -68,20 +68,20 @@ To test that it's working, create a very basic route for the AcmeDemoBundle: # app/config/routing.yml hello: path: /hello/{name} - defaults: { _controller: AcmeDemoBundle:Demo:hello } + defaults: { _controller: AppBundle:Demo:hello } .. code-block:: xml - AcmeDemoBundle:Demo:hello + AppBundle:Demo:hello .. code-block:: php // app/config/routing.php $collection->add('hello', new Route('/hello/{name}', array( - '_controller' => 'AcmeDemoBundle:Demo:hello', + '_controller' => 'AppBundle:Demo:hello', ))); Now generate the mod_rewrite rules: @@ -100,7 +100,7 @@ Which should roughly output the following: # hello RewriteCond %{REQUEST_URI} ^/hello/([^/]+?)$ - RewriteRule .* app.php [QSA,L,E=_ROUTING__route:hello,E=_ROUTING_name:%1,E=_ROUTING__controller:AcmeDemoBundle\:Demo\:hello] + RewriteRule .* app.php [QSA,L,E=_ROUTING__route:hello,E=_ROUTING_name:%1,E=_ROUTING__controller:AppBundle\:Demo\:hello] You can now rewrite ``web/.htaccess`` to use the new rules, so with this example it should look like this: @@ -116,7 +116,7 @@ it should look like this: # hello RewriteCond %{REQUEST_URI} ^/hello/([^/]+?)$ - RewriteRule .* app.php [QSA,L,E=_ROUTING__route:hello,E=_ROUTING_name:%1,E=_ROUTING__controller:AcmeDemoBundle\:Demo\:hello] + RewriteRule .* app.php [QSA,L,E=_ROUTING__route:hello,E=_ROUTING_name:%1,E=_ROUTING__controller:AppBundle\:Demo\:hello] .. note:: diff --git a/cookbook/configuration/override_dir_structure.rst b/cookbook/configuration/override_dir_structure.rst index 957438871a4..855769ce78a 100644 --- a/cookbook/configuration/override_dir_structure.rst +++ b/cookbook/configuration/override_dir_structure.rst @@ -154,3 +154,38 @@ file: $ php app/console cache:clear --env=prod $ php app/console assetic:dump --env=prod --no-debug + +Override the ``vendor`` Directory +--------------------------------- + +To override the ``vendor`` directory, you need to introduce changes in the +following files: + +* ``app/autoload.php`` +* ``composer.json`` + +The change in the ``composer.json`` will look like this: + +.. code-block:: json + + { + ... + "config": { + "bin-dir": "bin", + "vendor-dir": "/some/dir/vendor" + }, + ... + } + +In ``app/autoload.php``, you need to modify the path leading to the ``vendor/autoload.php`` +file:: + + // app/autoload.php + // ... + $loader = require '/some/dir/vendor/autoload.php'; + +.. tip:: + + This modification can be of interest if you are working in a virtual environment + and cannot use NFS - for example, if you're running a Symfony app using + Vagrant/VirtualBox in a guest operating system. diff --git a/cookbook/configuration/pdo_session_storage.rst b/cookbook/configuration/pdo_session_storage.rst index 9baa5fa9fb7..b94f5f34e3c 100644 --- a/cookbook/configuration/pdo_session_storage.rst +++ b/cookbook/configuration/pdo_session_storage.rst @@ -213,7 +213,7 @@ Example SQL Statements * A new session lifetime (``sess_lifetime`` by default) integer column needs to be added; * The data column (``sess_data`` by default) needs to be changed to a - BLOG type. + BLOB type. Check the SQL statements below for more details. diff --git a/cookbook/console/commands_as_services.rst b/cookbook/console/commands_as_services.rst index a60ebaa11e7..f31219d2fde 100644 --- a/cookbook/console/commands_as_services.rst +++ b/cookbook/console/commands_as_services.rst @@ -4,10 +4,6 @@ How to Define Commands as Services ================================== -.. versionadded:: 2.4 - Support for registering commands in the service container was introduced in - Symfony 2.4. - By default, Symfony will take a look in the ``Command`` directory of each bundle and automatically register your commands. If a command extends the :class:`Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerAwareCommand`, diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index b71b0792781..264f27a44d2 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -14,11 +14,11 @@ Automatically Registering Commands To make the console commands available automatically with Symfony, create a ``Command`` directory inside your bundle and create a PHP file suffixed with ``Command.php`` for each command that you want to provide. For example, if you -want to extend the AcmeDemoBundle to greet you from the command line, create +want to extend the AppBundle to greet you from the command line, create ``GreetCommand.php`` and add the following to it:: - // src/Acme/DemoBundle/Command/GreetCommand.php - namespace Acme\DemoBundle\Command; + // src/AppBundle/Command/GreetCommand.php + namespace AppBundle\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; @@ -156,7 +156,7 @@ instead of use Symfony\Component\Console\Tester\CommandTester; use Symfony\Bundle\FrameworkBundle\Console\Application; - use Acme\DemoBundle\Command\GreetCommand; + use AppBundle\Command\GreetCommand; class ListCommandTest extends \PHPUnit_Framework_TestCase { @@ -181,11 +181,6 @@ instead of } } -.. versionadded:: 2.4 - Since Symfony 2.4, the ``CommandTester`` automatically detects the name of - the command to execute. Prior to Symfony 2.4, you need to pass it via the - ``command`` key. - .. note:: In the specific case above, the ``name`` parameter and the ``--yell`` option @@ -199,7 +194,7 @@ you can extend your test from use Symfony\Component\Console\Tester\CommandTester; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; - use Acme\DemoBundle\Command\GreetCommand; + use AppBundle\Command\GreetCommand; class ListCommandTest extends KernelTestCase { @@ -225,13 +220,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/console/logging.rst b/cookbook/console/logging.rst index ae69c4264da..3bed28d5e7a 100644 --- a/cookbook/console/logging.rst +++ b/cookbook/console/logging.rst @@ -26,8 +26,8 @@ extends :class:`Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerAwareCommand This means that you can simply access the standard logger service through the container and use it to do the logging:: - // src/Acme/DemoBundle/Command/GreetCommand.php - namespace Acme\DemoBundle\Command; + // src/AppBundle/Command/GreetCommand.php + namespace AppBundle\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; @@ -84,7 +84,7 @@ First configure a listener for console exception events in the service container # app/config/services.yml services: kernel.listener.command_dispatch: - class: Acme\DemoBundle\EventListener\ConsoleExceptionListener + class: AppBundle\EventListener\ConsoleExceptionListener arguments: logger: "@logger" tags: @@ -99,7 +99,7 @@ First configure a listener for console exception events in the service container xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + @@ -113,7 +113,7 @@ First configure a listener for console exception events in the service container use Symfony\Component\DependencyInjection\Reference; $definitionConsoleExceptionListener = new Definition( - 'Acme\DemoBundle\EventListener\ConsoleExceptionListener', + 'AppBundle\EventListener\ConsoleExceptionListener', array(new Reference('logger')) ); $definitionConsoleExceptionListener->addTag( @@ -127,8 +127,8 @@ First configure a listener for console exception events in the service container Then implement the actual listener:: - // src/Acme/DemoBundle/EventListener/ConsoleExceptionListener.php - namespace Acme\DemoBundle\EventListener; + // src/AppBundle/EventListener/ConsoleExceptionListener.php + namespace AppBundle\EventListener; use Symfony\Component\Console\Event\ConsoleExceptionEvent; use Psr\Log\LoggerInterface; @@ -182,7 +182,7 @@ First configure a listener for console terminate events in the service container # app/config/services.yml services: kernel.listener.command_dispatch: - class: Acme\DemoBundle\EventListener\ErrorLoggerListener + class: AppBundle\EventListener\ErrorLoggerListener arguments: logger: "@logger" tags: @@ -197,7 +197,7 @@ First configure a listener for console terminate events in the service container xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + @@ -211,7 +211,7 @@ First configure a listener for console terminate events in the service container use Symfony\Component\DependencyInjection\Reference; $definitionErrorLoggerListener = new Definition( - 'Acme\DemoBundle\EventListener\ErrorLoggerListener', + 'AppBundle\EventListener\ErrorLoggerListener', array(new Reference('logger')) ); $definitionErrorLoggerListener->addTag( @@ -225,8 +225,8 @@ First configure a listener for console terminate events in the service container Then implement the actual listener:: - // src/Acme/DemoBundle/EventListener/ErrorLoggerListener.php - namespace Acme\DemoBundle\EventListener; + // src/AppBundle/EventListener/ErrorLoggerListener.php + namespace AppBundle\EventListener; use Symfony\Component\Console\Event\ConsoleTerminateEvent; use Psr\Log\LoggerInterface; diff --git a/cookbook/console/sending_emails.rst b/cookbook/console/sending_emails.rst index dd2e021cf93..74a04bf8255 100644 --- a/cookbook/console/sending_emails.rst +++ b/cookbook/console/sending_emails.rst @@ -66,7 +66,7 @@ Configuring the Request Context per Command To change it only in one command you can simply fetch the Request Context from the ``router`` service and override its settings:: - // src/Acme/DemoBundle/Command/DemoCommand.php + // src/AppBundle/Command/DemoCommand.php // ... class DemoCommand extends ContainerAwareCommand diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index 35199483430..a1b0b0f451c 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -234,7 +234,7 @@ to point to it. # app/config/config.yml twig: - exception_controller: AcmeFooBundle:Exception:showException + exception_controller: AppBundle:Exception:showException .. code-block:: xml @@ -247,7 +247,7 @@ to point to it. http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd"> - AcmeFooBundle:Exception:showException + AppBundle:Exception:showException @@ -255,7 +255,7 @@ to point to it. // app/config/config.php $container->loadFromExtension('twig', array( - 'exception_controller' => 'AcmeFooBundle:Exception:showException', + 'exception_controller' => 'AppBundle:Exception:showException', // ... )); diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 238d343b121..584d0ca2615 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -34,8 +34,8 @@ Defining the Controller as a Service A controller can be defined as a service in the same way as any other class. For example, if you have the following simple controller:: - // src/Acme/HelloBundle/Controller/HelloController.php - namespace Acme\HelloBundle\Controller; + // src/AppBundle/Controller/HelloController.php + namespace AppBundle\Controller; use Symfony\Component\HttpFoundation\Response; @@ -53,25 +53,25 @@ Then you can define it as a service as follows: .. code-block:: yaml - # src/Acme/HelloBundle/Resources/config/services.yml + # app/config/services.yml services: - acme.hello.controller: - class: Acme\HelloBundle\Controller\HelloController + app.hello_controller: + class: AppBundle\Controller\HelloController .. code-block:: xml - + - + .. code-block:: php - // src/Acme/HelloBundle/Resources/config/services.php + // app/config/services.php use Symfony\Component\DependencyInjection\Definition; - $container->setDefinition('acme.hello.controller', new Definition( - 'Acme\HelloBundle\Controller\HelloController' + $container->setDefinition('app.hello_controller', new Definition( + 'AppBundle\Controller\HelloController' )); Referring to the Service @@ -79,9 +79,9 @@ Referring to the Service To refer to a controller that's defined as a service, use the single colon (:) notation. For example, to forward to the ``indexAction()`` method of the service -defined above with the id ``acme.hello.controller``:: +defined above with the id ``app.hello_controller``:: - $this->forward('acme.hello.controller:indexAction', array('name' => $name)); + $this->forward('app.hello_controller:indexAction', array('name' => $name)); .. note:: @@ -98,20 +98,20 @@ the route ``_controller`` value: # app/config/routing.yml hello: path: /hello - defaults: { _controller: acme.hello.controller:indexAction } + defaults: { _controller: app.hello_controller:indexAction } .. code-block:: xml - acme.hello.controller:indexAction + app.hello_controller:indexAction .. code-block:: php // app/config/routing.php $collection->add('hello', new Route('/hello', array( - '_controller' => 'acme.hello.controller:indexAction', + '_controller' => 'app.hello_controller:indexAction', ))); .. tip:: @@ -137,8 +137,8 @@ For example, if you want to render a template instead of creating the ``Response object directly, then your code would look like this if you were extending Symfony's base controller:: - // src/Acme/HelloBundle/Controller/HelloController.php - namespace Acme\HelloBundle\Controller; + // src/AppBundle/Controller/HelloController.php + namespace AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; @@ -147,7 +147,7 @@ Symfony's base controller:: public function indexAction($name) { return $this->render( - 'AcmeHelloBundle:Hello:index.html.twig', + 'AppBundle:Hello:index.html.twig', array('name' => $name) ); } @@ -165,8 +165,8 @@ If you look at the source code for the ``render`` function in Symfony's In a controller that's defined as a service, you can instead inject the ``templating`` service and use it directly:: - // src/Acme/HelloBundle/Controller/HelloController.php - namespace Acme\HelloBundle\Controller; + // src/AppBundle/Controller/HelloController.php + namespace AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; use Symfony\Component\HttpFoundation\Response; @@ -183,7 +183,7 @@ service and use it directly:: public function indexAction($name) { return $this->templating->renderResponse( - 'AcmeHelloBundle:Hello:index.html.twig', + 'AppBundle:Hello:index.html.twig', array('name' => $name) ); } @@ -196,29 +196,29 @@ argument: .. code-block:: yaml - # src/Acme/HelloBundle/Resources/config/services.yml + # app/config/services.yml services: - acme.hello.controller: - class: Acme\HelloBundle\Controller\HelloController + app.hello_controller: + class: AppBundle\Controller\HelloController arguments: ["@templating"] .. code-block:: xml - + - + .. code-block:: php - // src/Acme/HelloBundle/Resources/config/services.php + // app/config/services.php use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; - $container->setDefinition('acme.hello.controller', new Definition( - 'Acme\HelloBundle\Controller\HelloController', + $container->setDefinition('app.hello_controller', new Definition( + 'AppBundle\Controller\HelloController', array(new Reference('templating')) )); diff --git a/cookbook/doctrine/custom_dql_functions.rst b/cookbook/doctrine/custom_dql_functions.rst index dcdfc6bc492..747a353e7a5 100644 --- a/cookbook/doctrine/custom_dql_functions.rst +++ b/cookbook/doctrine/custom_dql_functions.rst @@ -19,12 +19,12 @@ In Symfony, you can register your custom DQL functions as follows: # ... dql: string_functions: - test_string: Acme\HelloBundle\DQL\StringFunction - second_string: Acme\HelloBundle\DQL\SecondStringFunction + test_string: AppBundle\DQL\StringFunction + second_string: AppBundle\DQL\SecondStringFunction numeric_functions: - test_numeric: Acme\HelloBundle\DQL\NumericFunction + test_numeric: AppBundle\DQL\NumericFunction datetime_functions: - test_datetime: Acme\HelloBundle\DQL\DatetimeFunction + test_datetime: AppBundle\DQL\DatetimeFunction .. code-block:: xml @@ -39,10 +39,10 @@ In Symfony, you can register your custom DQL functions as follows: - Acme\HelloBundle\DQL\StringFunction - Acme\HelloBundle\DQL\SecondStringFunction - Acme\HelloBundle\DQL\NumericFunction - Acme\HelloBundle\DQL\DatetimeFunction + AppBundle\DQL\StringFunction + AppBundle\DQL\SecondStringFunction + AppBundle\DQL\NumericFunction + AppBundle\DQL\DatetimeFunction @@ -56,14 +56,14 @@ In Symfony, you can register your custom DQL functions as follows: // ... 'dql' => array( 'string_functions' => array( - 'test_string' => 'Acme\HelloBundle\DQL\StringFunction', - 'second_string' => 'Acme\HelloBundle\DQL\SecondStringFunction', + 'test_string' => 'AppBundle\DQL\StringFunction', + 'second_string' => 'AppBundle\DQL\SecondStringFunction', ), 'numeric_functions' => array( - 'test_numeric' => 'Acme\HelloBundle\DQL\NumericFunction', + 'test_numeric' => 'AppBundle\DQL\NumericFunction', ), 'datetime_functions' => array( - 'test_datetime' => 'Acme\HelloBundle\DQL\DatetimeFunction', + 'test_datetime' => 'AppBundle\DQL\DatetimeFunction', ), ), ), diff --git a/cookbook/doctrine/dbal.rst b/cookbook/doctrine/dbal.rst index 73d9e07e109..39cb0eabeaf 100644 --- a/cookbook/doctrine/dbal.rst +++ b/cookbook/doctrine/dbal.rst @@ -93,8 +93,8 @@ mapping types, read Doctrine's `Custom Mapping Types`_ section of their document doctrine: dbal: types: - custom_first: Acme\HelloBundle\Type\CustomFirst - custom_second: Acme\HelloBundle\Type\CustomSecond + custom_first: AppBundle\Type\CustomFirst + custom_second: AppBundle\Type\CustomSecond .. code-block:: xml @@ -107,8 +107,8 @@ mapping types, read Doctrine's `Custom Mapping Types`_ section of their document - - + + @@ -119,8 +119,8 @@ mapping types, read Doctrine's `Custom Mapping Types`_ section of their document $container->loadFromExtension('doctrine', array( 'dbal' => array( 'types' => array( - 'custom_first' => 'Acme\HelloBundle\Type\CustomFirst', - 'custom_second' => 'Acme\HelloBundle\Type\CustomSecond', + 'custom_first' => 'AppBundle\Type\CustomFirst', + 'custom_second' => 'AppBundle\Type\CustomSecond', ), ), )); diff --git a/cookbook/doctrine/file_uploads.rst b/cookbook/doctrine/file_uploads.rst index fa400525187..b68806f59d4 100644 --- a/cookbook/doctrine/file_uploads.rst +++ b/cookbook/doctrine/file_uploads.rst @@ -23,8 +23,8 @@ Basic Setup First, create a simple Doctrine entity class to work with:: - // src/Acme/DemoBundle/Entity/Document.php - namespace Acme\DemoBundle\Entity; + // src/AppBundle/Entity/Document.php + namespace AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; @@ -154,8 +154,8 @@ rules:: .. code-block:: yaml - # src/Acme/DemoBundle/Resources/config/validation.yml - Acme\DemoBundle\Entity\Document: + # src/AppBundle/Resources/config/validation.yml + AppBundle\Entity\Document: properties: file: - File: @@ -163,8 +163,8 @@ rules:: .. code-block:: php-annotations - // src/Acme/DemoBundle/Entity/Document.php - namespace Acme\DemoBundle\Entity; + // src/AppBundle/Entity/Document.php + namespace AppBundle\Entity; // ... use Symfony\Component\Validator\Constraints as Assert; @@ -181,8 +181,8 @@ rules:: .. code-block:: xml - - + + @@ -192,7 +192,7 @@ rules:: .. code-block:: php - // src/Acme/DemoBundle/Entity/Document.php + // src/AppBundle/Entity/Document.php namespace Acme\DemoBundle\Entity; // ... @@ -220,7 +220,7 @@ rules:: The following controller shows you how to handle the entire process:: // ... - use Acme\DemoBundle\Entity\Document; + use AppBundle\Entity\Document; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\HttpFoundation\Request; // ... diff --git a/cookbook/doctrine/multiple_entity_managers.rst b/cookbook/doctrine/multiple_entity_managers.rst index 689d9d1bba2..ce2a3f685c6 100644 --- a/cookbook/doctrine/multiple_entity_managers.rst +++ b/cookbook/doctrine/multiple_entity_managers.rst @@ -49,7 +49,7 @@ The following configuration code shows how you can configure two entity managers default: connection: default mappings: - AcmeDemoBundle: ~ + AppBundle: ~ AcmeStoreBundle: ~ customer: connection: customer @@ -90,7 +90,7 @@ The following configuration code shows how you can configure two entity managers - + @@ -134,7 +134,7 @@ The following configuration code shows how you can configure two entity managers 'default' => array( 'connection' => 'default', 'mappings' => array( - 'AcmeDemoBundle' => null, + 'AppBundle' => null, 'AcmeStoreBundle' => null, ), ), @@ -150,7 +150,7 @@ The following configuration code shows how you can configure two entity managers In this case, you've defined two entity managers and called them ``default`` and ``customer``. The ``default`` entity manager manages entities in the -``AcmeDemoBundle`` and ``AcmeStoreBundle``, while the ``customer`` entity +``AppBundle`` and ``AcmeStoreBundle``, while the ``customer`` entity manager manages entities in the ``AcmeCustomerBundle``. You've also defined two connections, one for each entity manager. diff --git a/cookbook/email/testing.rst b/cookbook/email/testing.rst index db6e717ec36..d5fce3b4186 100644 --- a/cookbook/email/testing.rst +++ b/cookbook/email/testing.rst @@ -33,7 +33,7 @@ Start with an easy controller action that sends an e-mail:: In your functional test, use the ``swiftmailer`` collector on the profiler to get information about the messages send on the previous request:: - // src/Acme/DemoBundle/Tests/Controller/MailControllerTest.php + // src/AppBundle/Tests/Controller/MailControllerTest.php use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class MailControllerTest extends WebTestCase diff --git a/cookbook/event_dispatcher/before_after_filters.rst b/cookbook/event_dispatcher/before_after_filters.rst index 28ca972faec..262365037b5 100644 --- a/cookbook/event_dispatcher/before_after_filters.rst +++ b/cookbook/event_dispatcher/before_after_filters.rst @@ -74,7 +74,7 @@ controller that matches the request needs token validation. A clean and easy way is to create an empty interface and make the controllers implement it:: - namespace Acme\DemoBundle\Controller; + namespace AppBundle\Controller; interface TokenAuthenticatedController { @@ -83,9 +83,9 @@ implement it:: A controller that implements this interface simply looks like this:: - namespace Acme\DemoBundle\Controller; + namespace AppBundle\Controller; - use Acme\DemoBundle\Controller\TokenAuthenticatedController; + use AppBundle\Controller\TokenAuthenticatedController; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class FooController extends Controller implements TokenAuthenticatedController @@ -104,10 +104,10 @@ Next, you'll need to create an event listener, which will hold the logic that you want executed before your controllers. If you're not familiar with event listeners, you can learn more about them at :doc:`/cookbook/service_container/event_listener`:: - // src/Acme/DemoBundle/EventListener/TokenListener.php - namespace Acme\DemoBundle\EventListener; + // src/AppBundle/EventListener/TokenListener.php + namespace AppBundle\EventListener; - use Acme\DemoBundle\Controller\TokenAuthenticatedController; + use AppBundle\Controller\TokenAuthenticatedController; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; @@ -153,33 +153,33 @@ your listener to be called just before any controller is executed. .. code-block:: yaml - # app/config/config.yml (or inside your services.yml) + # app/config/services.yml services: - demo.tokens.action_listener: - class: Acme\DemoBundle\EventListener\TokenListener + app.tokens.action_listener: + class: AappBundle\EventListener\TokenListener arguments: ["%tokens%"] tags: - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } .. code-block:: xml - - + + %tokens% .. code-block:: php - // app/config/config.php (or inside your services.php) + // app/config/services.php use Symfony\Component\DependencyInjection\Definition; - $listener = new Definition('Acme\DemoBundle\EventListener\TokenListener', array('%tokens%')); + $listener = new Definition('AppBundle\EventListener\TokenListener', array('%tokens%')); $listener->addTag('kernel.event_listener', array( 'event' => 'kernel.controller', 'method' => 'onKernelController' )); - $container->setDefinition('demo.tokens.action_listener', $listener); + $container->setDefinition('app.tokens.action_listener', $listener); With this configuration, your ``TokenListener`` ``onKernelController`` method will be executed on each request. If the controller that is about to be executed @@ -248,10 +248,10 @@ event: .. code-block:: yaml - # app/config/config.yml (or inside your services.yml) + # app/config/services.yml services: - demo.tokens.action_listener: - class: Acme\DemoBundle\EventListener\TokenListener + app.tokens.action_listener: + class: AppBundle\EventListener\TokenListener arguments: ["%tokens%"] tags: - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } @@ -259,8 +259,8 @@ event: .. code-block:: xml - - + + %tokens% @@ -268,10 +268,10 @@ event: .. code-block:: php - // app/config/config.php (or inside your services.php) + // app/config/services.php use Symfony\Component\DependencyInjection\Definition; - $listener = new Definition('Acme\DemoBundle\EventListener\TokenListener', array('%tokens%')); + $listener = new Definition('AppBundle\EventListener\TokenListener', array('%tokens%')); $listener->addTag('kernel.event_listener', array( 'event' => 'kernel.controller', 'method' => 'onKernelController' @@ -280,7 +280,7 @@ event: 'event' => 'kernel.response', 'method' => 'onKernelResponse' )); - $container->setDefinition('demo.tokens.action_listener', $listener); + $container->setDefinition('app.tokens.action_listener', $listener); That's it! The ``TokenListener`` is now notified before every controller is executed (``onKernelController``) and after every controller returns a response diff --git a/cookbook/expression/expressions.rst b/cookbook/expression/expressions.rst index 750fadf1aab..63fc728343c 100644 --- a/cookbook/expression/expressions.rst +++ b/cookbook/expression/expressions.rst @@ -4,9 +4,6 @@ How to use Expressions in Security, Routing, Services, and Validation ===================================================================== -.. versionadded:: 2.4 - The expression functionality was introduced in Symfony 2.4. - In Symfony 2.4, a powerful :doc:`ExpressionLanguage ` component was added to Symfony. This allows us to add highly customized logic inside configuration. @@ -28,9 +25,6 @@ For more information about how to create and work with expressions, see Security: Complex Access Controls with Expressions -------------------------------------------------- -.. versionadded:: 2.4 - The expression functionality was introduced in Symfony 2.4. - In addition to a role like ``ROLE_ADMIN``, the ``isGranted`` method also accepts an :class:`Symfony\\Component\\ExpressionLanguage\\Expression` object:: diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index a472ad7e687..62d1c454eeb 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -20,8 +20,8 @@ will be called ``GenderType`` and the file will be stored in the default locatio for form fields, which is ``\Form\Type``. Make sure the field extends :class:`Symfony\\Component\\Form\\AbstractType`:: - // src/Acme/DemoBundle/Form/Type/GenderType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/GenderType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\OptionsResolver\OptionsResolverInterface; @@ -111,7 +111,7 @@ link for details), create a ``gender_widget`` block to handle this: .. code-block:: html+jinja - {# src/Acme/DemoBundle/Resources/views/Form/fields.html.twig #} + {# src/AppBundle/Resources/views/Form/fields.html.twig #} {% block gender_widget %} {% spaceless %} {% if expanded %} @@ -132,7 +132,7 @@ link for details), create a ``gender_widget`` block to handle this: .. code-block:: html+php - +
    block($form, 'widget_container_attributes') ?>> @@ -163,13 +163,13 @@ link for details), create a ``gender_widget`` block to handle this: # app/config/config.yml twig: form_themes: - - 'AcmeDemoBundle:Form:fields.html.twig' + - 'AppBundle:Form:fields.html.twig' .. code-block:: xml - AcmeDemoBundle:Form:fields.html.twig + AppBundle:Form:fields.html.twig .. code-block:: php @@ -177,7 +177,7 @@ link for details), create a ``gender_widget`` block to handle this: // app/config/config.php $container->loadFromExtension('twig', array( 'form_themes' => array( - 'AcmeDemoBundle:Form:fields.html.twig', + 'AppBundle:Form:fields.html.twig', ), )); @@ -192,7 +192,7 @@ link for details), create a ``gender_widget`` block to handle this: templating: form: resources: - - 'AcmeDemoBundle:Form' + - 'AppBundle:Form' .. code-block:: xml @@ -207,7 +207,7 @@ link for details), create a ``gender_widget`` block to handle this: - AcmeDemoBundle:Form + AppBundle:Form @@ -220,7 +220,7 @@ link for details), create a ``gender_widget`` block to handle this: 'templating' => array( 'form' => array( 'resources' => array( - 'AcmeDemoBundle:Form', + 'AppBundle:Form', ), ), ), @@ -232,8 +232,8 @@ Using the Field Type You can now use your custom field type immediately, simply by creating a new instance of the type in one of your forms:: - // src/Acme/DemoBundle/Form/Type/AuthorType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/AuthorType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -300,10 +300,10 @@ the ``genders`` parameter value as the first argument to its to-be-created .. code-block:: yaml - # src/Acme/DemoBundle/Resources/config/services.yml + # src/AppBundle/Resources/config/services.yml services: - acme_demo.form.type.gender: - class: Acme\DemoBundle\Form\Type\GenderType + app.form.type.gender: + class: AppBundle\Form\Type\GenderType arguments: - "%genders%" tags: @@ -311,20 +311,20 @@ the ``genders`` parameter value as the first argument to its to-be-created .. code-block:: xml - - + + %genders% .. code-block:: php - // src/Acme/DemoBundle/Resources/config/services.php + // src/AppBundle/Resources/config/services.php use Symfony\Component\DependencyInjection\Definition; $container - ->setDefinition('acme_demo.form.type.gender', new Definition( - 'Acme\DemoBundle\Form\Type\GenderType', + ->setDefinition('app.form.type.gender', new Definition( + 'AppBundle\Form\Type\GenderType', array('%genders%') )) ->addTag('form.type', array( @@ -342,8 +342,8 @@ returned by the ``getName`` method defined earlier. You'll see the importance of this in a moment when you use the custom field type. But first, add a ``__construct`` method to ``GenderType``, which receives the gender configuration:: - // src/Acme/DemoBundle/Form/Type/GenderType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/GenderType.php + namespace AppBundle\Form\Type; use Symfony\Component\OptionsResolver\OptionsResolverInterface; @@ -373,8 +373,8 @@ Great! The ``GenderType`` is now fueled by the configuration parameters and registered as a service. Additionally, because you used the ``form.type`` alias in its configuration, using the field is now much easier:: - // src/Acme/DemoBundle/Form/Type/AuthorType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/AuthorType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\FormBuilderInterface; diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 0389ae88fb9..df1a9e9f24c 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -36,8 +36,8 @@ Customizing your Form Based on the Underlying Data Before jumping right into dynamic form generation, hold on and recall what a bare form class looks like:: - // src/Acme/DemoBundle/Form/Type/ProductType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/ProductType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -54,7 +54,7 @@ a bare form class looks like:: public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => 'Acme\DemoBundle\Entity\Product' + 'data_class' => 'AppBundle\Entity\Product' )); } @@ -90,8 +90,8 @@ Adding an Event Listener to a Form Class So, instead of directly adding that ``name`` widget, the responsibility of creating that particular field is delegated to an event listener:: - // src/Acme/DemoBundle/Form/Type/ProductType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/ProductType.php + namespace AppBundle\Form\Type; // ... use Symfony\Component\Form\FormEvent; @@ -151,11 +151,11 @@ For better reusability or if there is some heavy logic in your event listener, you can also move the logic for creating the ``name`` field to an :ref:`event subscriber `:: - // src/Acme/DemoBundle/Form/Type/ProductType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/ProductType.php + namespace AppBundle\Form\Type; // ... - use Acme\DemoBundle\Form\EventListener\AddNameFieldSubscriber; + use AppBundle\Form\EventListener\AddNameFieldSubscriber; class ProductType extends AbstractType { @@ -172,8 +172,8 @@ you can also move the logic for creating the ``name`` field to an Now the logic for creating the ``name`` field resides in it own subscriber class:: - // src/Acme/DemoBundle/Form/EventListener/AddNameFieldSubscriber.php - namespace Acme\DemoBundle\Form\EventListener; + // src/AppBundle/Form/EventListener/AddNameFieldSubscriber.php + namespace AppBundle\Form\EventListener; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; @@ -216,8 +216,8 @@ Creating the Form Type Using an event listener, your form might look like this:: - // src/Acme/DemoBundle/Form/Type/FriendMessageFormType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/FriendMessageFormType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -278,7 +278,7 @@ Customizing the Form Type Now that you have all the basics in place you can take advantage of the ``TokenStorageInterface`` and fill in the listener logic:: - // src/Acme/DemoBundle/FormType/FriendMessageFormType.php + // src/AppBundle/FormType/FriendMessageFormType.php use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Doctrine\ORM\EntityRepository; @@ -314,7 +314,7 @@ and fill in the listener logic:: $form = $event->getForm(); $formOptions = array( - 'class' => 'Acme\DemoBundle\Entity\User', + 'class' => 'AppBundle\Entity\User', 'property' => 'fullName', 'query_builder' => function (EntityRepository $er) use ($user) { // build a custom query @@ -389,8 +389,8 @@ it with :ref:`dic-tags-form-type`. # app/config/config.yml services: - acme.form.friend_message: - class: Acme\DemoBundle\Form\Type\FriendMessageFormType + app.form.friend_message: + class: AppBundle\Form\Type\FriendMessageFormType arguments: ["@security.token_storage"] tags: - { name: form.type, alias: acme_friend_message } @@ -399,7 +399,7 @@ it with :ref:`dic-tags-form-type`. - + @@ -408,10 +408,10 @@ it with :ref:`dic-tags-form-type`. .. code-block:: php // app/config/config.php - $definition = new Definition('Acme\DemoBundle\Form\Type\FriendMessageFormType'); + $definition = new Definition('AppBundle\Form\Type\FriendMessageFormType'); $definition->addTag('form.type', array('alias' => 'acme_friend_message')); $container->setDefinition( - 'acme.form.friend_message', + 'app.form.friend_message', $definition, array('security.token_storage') ); @@ -459,8 +459,8 @@ will need the correct options in order for validation to pass. The meetup is passed as an entity field to the form. So we can access each sport like this:: - // src/Acme/DemoBundle/Form/Type/SportMeetupType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/SportMeetupType.php + namespace AppBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -474,7 +474,7 @@ sport like this:: { $builder ->add('sport', 'entity', array( - 'class' => 'AcmeDemoBundle:Sport', + 'class' => 'AppBundle:Sport', 'placeholder' => '', )) ; @@ -491,7 +491,7 @@ sport like this:: $positions = null === $sport ? array() : $sport->getAvailablePositions(); $form->add('position', 'entity', array( - 'class' => 'AcmeDemoBundle:Position', + 'class' => 'AppBundle:Position', 'placeholder' => '', 'choices' => $positions, )); @@ -532,12 +532,12 @@ new field automatically and map it to the submitted client data. The type would now look like:: - // src/Acme/DemoBundle/Form/Type/SportMeetupType.php - namespace Acme\DemoBundle\Form\Type; + // src/AppBundle/Form/Type/SportMeetupType.php + namespace AppBundle\Form\Type; // ... use Symfony\Component\Form\FormInterface; - use Acme\DemoBundle\Entity\Sport; + use AppBundle\Entity\Sport; class SportMeetupType extends AbstractType { @@ -545,7 +545,7 @@ The type would now look like:: { $builder ->add('sport', 'entity', array( - 'class' => 'AcmeDemoBundle:Sport', + 'class' => 'AppBundle:Sport', 'placeholder' => '', )); ; @@ -554,7 +554,7 @@ The type would now look like:: $positions = null === $sport ? array() : $sport->getAvailablePositions(); $form->add('position', 'entity', array( - 'class' => 'AcmeDemoBundle:Position', + 'class' => 'AppBundle:Position', 'placeholder' => '', 'choices' => $positions, )); @@ -596,13 +596,13 @@ One piece that is still missing is the client-side updating of your form after the sport is selected. This should be handled by making an AJAX call back to your application. Assume that you have a sport meetup creation controller:: - // src/Acme/DemoBundle/Controller/MeetupController.php - namespace Acme\DemoBundle\Controller; + // src/AppBundle/Controller/MeetupController.php + namespace AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; - use Acme\DemoBundle\Entity\SportMeetup; - use Acme\DemoBundle\Form\Type\SportMeetupType; + use AppBundle\Entity\SportMeetup; + use AppBundle\Form\Type\SportMeetupType; // ... class MeetupController extends Controller @@ -617,7 +617,7 @@ your application. Assume that you have a sport meetup creation controller:: } return $this->render( - 'AcmeDemoBundle:Meetup:create.html.twig', + 'AppBundle:Meetup:create.html.twig', array('form' => $form->createView()) ); } @@ -632,7 +632,7 @@ field according to the current selection in the ``sport`` field: .. code-block:: html+jinja - {# src/Acme/DemoBundle/Resources/views/Meetup/create.html.twig #} + {# src/AppBundle/Resources/views/Meetup/create.html.twig #} {{ form_start(form) }} {{ form_row(form.sport) }} {#