8000 Merge branch '2.7' · symfony/symfony-docs@907ee0d · GitHub
[go: up one dir, main page]

Skip to content

Commit 907ee0d

Browse files
committed
Merge branch '2.7'
* 2.7: (31 commits) fix merge after removing @Security in 2.3 Reverting a commit on 2.5 branch, as it was only meant to be on 2.3 (so reverting after the merge) [#4735] Reverting what was left on the 2.5 branch after the merge conflict had already put back some of it Typo Fix: "allows to" should be "allows you to" Adding a link to log things in the prod environment [#4857] Adding missing word thanks to xabbuh move cautions to make them visible Fixing bad english thanks to xabbuh Adding missing words thanks to javiereguiluz language tweak thanks to xabbuh! Adding an example image of the debug_formatter [#4643] Minor english changes to make things even smoother (though they were correct before) replace API link for SwiftmailerBundle Update security.rst Update routing.rst don't output message from AuthenticationException Add custom link labels where Cookbook articles titles looked wrong Fix typo: BLOG => BLOB Fix code example Removed a leftover comma in security config sample ...
2 parents a17bdd7 + 7363c9b commit 907ee0d
  • dependency_injection
  • event_dispatcher
  • expression_language
  • filesystem
  • form
  • http_foundation
  • http_kernel
  • property_access
  • templating/helpers
  • translation
  • cookbook
  • service_container
  • session
  • templating
  • testing
  • validation
  • web_services
  • images/components/console
  • reference
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    126 files changed

    +678
    -922
    lines changed

    best_practices/configuration.rst

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -74,8 +74,8 @@ add an extra layer of configuration that's not needed because you don't need
    7474
    or want these configuration values to change on each server.
    7575

    7676
    The configuration options defined in the ``config.yml`` file usually vary from
    77-
    one :doc:`/cookbook/configuration/environments` to another. That's why Symfony
    78-
    already includes ``app/config/config_dev.yml`` and ``app/config/config_prod.yml``
    77+
    one :doc:`environment </cookbook/configuration/environments>` to another. That's
    78+
    why Symfony already includes ``app/config/config_dev.yml`` and ``app/config/config_prod.yml``
    7979
    files so that you can override specific values for each environment.
    8080

    8181
    Constants vs Configuration Options

    best_practices/controllers.rst

    Lines changed: 3 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -139,7 +139,7 @@ For example:
    139139
    140140
    use AppBundle\Entity\Post;
    141141
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
    142-
    142+
    143143
    /**
    144144
    * @Route("/{id}", name="admin_post_show")
    145145
    */
    @@ -212,6 +212,7 @@ Pre and Post Hooks
    212212
    ------------------
    213213

    214214
    If you need to execute some code before or after the execution of your controllers,
    215-
    you can use the EventDispatcher component to :doc:`/cookbook/event_dispatcher/before_after_filters`.
    215+
    you can use the EventDispatcher component to
    216+
    :doc:`set up before and after filters </cookbook/event_dispatcher/before_after_filters>`.
    216217

    217218
    .. _`ParamConverter`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html

    best_practices/forms.rst

    Lines changed: 3 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -165,8 +165,9 @@ fields:
    165165

    166166
    If you need more control over how your fields are rendered, then you should
    167167
    remove the ``form_widget(form)`` function and render your fields individually.
    168-
    See :doc:`/cookbook/form/form_customization` for more information on this and how
    169-
    you can control *how* the form renders at a global level using form theming.
    168+
    See the :doc:`/cookbook/form/form_customization` article for more information
    169+
    on this and how you can control *how* the form renders at a global level
    170+
    using form theming.
    170171

    171172
    Handling Form Submits
    172173
    ---------------------

    best_practices/security.rst

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -208,6 +208,8 @@ Now you can reuse this method both in the template and in the security expressio
    208208
    {% endif %}
    209209

    210210
    .. _best-practices-directly-isGranted:
    211+
    .. _checking-permissions-without-security:
    212+
    .. _manually-checking-permissions:
    211213

    212214
    Checking Permissions without @Security
    213215
    --------------------------------------

    book/controller.rst

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -683,9 +683,6 @@ content that's sent back to the client::
    683683
    $response = new Response(json_encode(array('name' => $name)));
    684684
    $response->headers->set('Content-Type', 'application/json');
    685685

    686-
    .. versionadded:: 2.4
    687-
    Support for HTTP status code constants was introduced in Symfony 2.4.
    688-
    689686
    The ``headers`` property is a :class:`Symfony\\Component\\HttpFoundation\\HeaderBag`
    690687
    object and has some nice methods for getting and setting the headers. The
    691688
    header names are normalized so that using ``Content-Type`` is equivalent to

    book/from_flat_php_to_symfony2.rst

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -484,9 +484,6 @@ the HTTP response being returned. Use them to improve the blog:
    484484
    // echo the headers and send the response
    485485
    $response->send();
    486486

    487-
    .. versionadded:: 2.4
    488-
    Support for HTTP status code constants was introduced in Symfony 2.4.
    489-
    490487
    The controllers are now responsible for returning a ``Response`` object.
    491488
    To make this easier, you can add a new ``render_template()`` function, which,
    492489
    incidentally, acts quite a bit like the Symfony templating engine:

    book/http_fundamentals.rst

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -287,9 +287,6 @@ interface to construct the response that needs to be returned to the client::
    287287
    // prints the HTTP headers followed by the content
    288288
    $response->send();
    289289

    290-
    .. versionadded:: 2.4
    291-
    Support for HTTP status code constants was introduced in Symfony 2.4.
    292-
    293290
    If Symfony offered nothing else, you would already have a toolkit for easily
    294291
    accessing request information and an object-oriented interface for creating
    295292
    the response. Even as you learn the many powerful features in Symfony, keep

    book/internals.rst

    Lines changed: 0 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -208,10 +208,6 @@ processing must only occur on the master request).
    208208
    Events
    209209
    ~~~~~~
    210210

    211-
    .. versionadded:: 2.4
    212-
    The ``isMasterRequest()`` method was introduced in Symfony 2.4.
    213-
    Prior, the ``getRequestType()`` method must be used.
    214-
    215211
    Each event thrown by the Kernel is a subclass of
    216212
    :class:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent`. This means that
    217213
    each event has access to the same basic information:

    book/routing.rst

    Lines changed: 1 addition & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -644,7 +644,7 @@ be added for each parameter. For example:
    644644

    645645
    .. configuration-block::
    646646

    647-
    .. code-block:: php
    647+
    .. code-block:: php-annotations
    648648
    649649
    // src/AppBundle/Controller/BlogController.php
    650650
    @@ -915,9 +915,6 @@ component documentation.
    915915
    Completely Customized Route Matching with Conditions
    916916
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    917917

    918-
    .. versionadded:: 2.4
    919-
    Route conditions were introduced in Symfony 2.4.
    920-
    921918
    As you've seen, a route can be made to match only certain routing wildcards
    922919
    (via regular expressions), HTTP methods, or host names. But the routing system
    923920
    can be extended to have an almost infinite flexibility using ``conditions``:

    book/security.rst

    Lines changed: 2 additions & 13 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@ Security
    55
    ========
    66

    77
    Symfony's security system is incredibly powerful, but it can also be confusing 97AE
    8-
    to setup. In this chapter, you'll learn how to setup your application's security
    8+
    to set up. In this chapter, you'll learn how to set up your application's security
    99
    step-by-step, from configuring your firewall and how you load users to denying
    1010
    access and fetching the User object. Depending on what you need, sometimes
    1111
    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:
    300300
    memory:
    301301
    users:
    302302
    ryan:
    303-
    password: ryanpass,
    303+
    password: ryanpass
    304304
    roles: 'ROLE_USER'
    305305
    admin:
    306306
    password: kitten
    @@ -808,9 +808,6 @@ You can easily deny access from inside a controller::
    808808
    The ``security.authorization_checker`` service was introduced in Symfony 2.6. Prior
    809809
    to Symfony 2.6, you had to use the ``isGranted()`` method of the ``security.context`` service.
    810810

    811-
    .. versionadded:: 2.5
    812-
    The ``createAccessDeniedException`` method was introduced in Symfony 2.5.
    813-
    814811
    The :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::createAccessDeniedException`
    815812
    method creates a special :class:`Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException`
    816813
    object, which ultimately triggers a 403 HTTP response inside Symfony.
    @@ -925,9 +922,6 @@ special attributes like this:
    925922

    926923
    .. _book-security-template-expression:
    927924

    928-
    .. versionadded:: 2.4
    929-
    The ``expression`` functionality was introduced in Symfony 2.4.
    930-
    931925
    You can also use expressions inside your templates:
    932926

    933927
    .. configuration-block::
    @@ -1304,11 +1298,6 @@ cookie will be ever created by Symfony):
    13041298
    Checking for Known Security Vulnerabilities in Dependencies
    13051299
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    13061300

    1307-
    .. versionadded:: 2.5
    1308-
    The ``security:check`` command was introduced in Symfony 2.5. This command is
    1309-
    included in ``SensioDistributionBundle``, which has to be registered in your
    1310-
    application in order to use this command.
    1311-
    13121301
    When using lots of dependencies in your Symfony projects, some of them may
    13131302
    contain security vulnerabilities. That's why Symfony includes a command called
    13141303
    ``security:check`` that checks your ``composer.lock`` file to find any known

    book/service_container.rst

    Lines changed: 0 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -624,9 +624,6 @@ the work of instantiating the classes.
    624624
    Using the Expression Language
    625625
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    626626

    627-
    .. versionadded:: 2.4
    628-
    The Expression Language functionality was introduced in Symfony 2.4.
    629-
    630627
    The service container also supports an "expression" that allows you to inject
    631628
    very specific values into a service.
    632629

    @@ -818,9 +815,6 @@ Injecting the dependency by the setter method just needs a change of syntax:
    818815
    Injecting the Request
    819816
    ~~~~~~~~~~~~~~~~~~~~~
    820817

    821-
    .. versionadded:: 2.4
    822-
    The ``request_stack`` service was introduced in Symfony 2.4.
    823-
    824818
    As of Symfony 2.4, instead of injecting the ``request`` service, you should
    825819
    inject the ``request_stack`` service and access the ``Request`` by calling
    826820
    the :method:`Symfony\\Component\\HttpFoundation\\RequestStack::getCurrentRequest`

    book/templating.rst

    Expand all lines: book/templating.rst
    Lines changed: 0 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1021,9 +1021,6 @@ configuration option.
    10211021

    10221022
    .. _`book-templating-version-by-asset`:
    10231023

    1024-
    .. versionadded:: 2.5
    1025-
    Setting versioned URLs on an asset-by-asset basis was introduced in Symfony 2.5.
    1026-
    10271024
    If you need to set a version for a specific asset, you can set the fourth
    10281025
    argument (or the ``version`` argument) to the desired version:
    10291026

    @@ -1046,9 +1043,6 @@ If you don't give a version or pass ``null``, the default package version
    10461043
    (from :ref:`ref-framework-assets-version`) will be used. If you pass ``false``,
    10471044
    versioned URL will be deactivated for this asset.
    10481045

    1049-
    .. versionadded:: 2.5
    1050-
    Absolute URLs for assets were introduced in Symfony 2.5.
    1051-
    10521046
    If you need absolute URLs for assets, you can set the third argument (or the
    10531047
    ``absolute`` argument) to ``true``:
    10541048

    book/testing.rst

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -17,8 +17,8 @@ it has its own excellent `documentation`_.
    1717

    1818
    .. note::
    1919

    20-
    Symfony works with PHPUnit 3.5.11 or later, though version 3.6.4 is
    21-
    needed to test the Symfony core code itself.
    20+
    It's recommended to use the latest stable PHPUnit version (you will have
    21+
    to use version 4.2 or higher to test the Symfony core code itself).
    2222

    2323
    Each test - whether it's a unit test or a functional test - is a PHP class
    2424
    that should live in the ``Tests/`` subdirectory of your bundles. If you follow

    book/translation.rst

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -670,9 +670,6 @@ see the documentation for these libraries.
    670670
    Debugging Translations
    671671
    ----------------------
    672672

    673-
    .. versionadded:: 2.5
    674-
    The ``debug:translation`` command was introduced in Symfony 2.5.
    675-
    676673
    .. versionadded:: 2.6
    677674
    Prior to Symfony 2.6, this command was called ``translation:debug``.
    678675

    book/validation.rst

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -586,9 +586,6 @@ allows you to add a constraint to any public method whose name starts with
    586586
    "get", "is" or "has". In this guide, these types of methods are referred to
    587587
    as "getters".
    588588

    589-
    .. versionadded:: 2.5
    590-
    Support for methods starting with ``has`` was introduced in Symfony 2.5.
    591-
    592589
    The benefit of this technique is that it allows you to validate your object
    593590
    dynamically. For example, suppose you want to make sure that a password field
    594591
    doesn't match the first name of the user (for security reasons). You can
    Lines changed: 6 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,9 +1,11 @@
    11
    .. index::
    22
    single: ClassLoader; DebugClassLoader
    3-
    3+
    44
    Debugging a Class Loader
    55
    ========================
    66

    7-
    Since Symfony 2.4, the ``DebugClassLoader`` of the Class Loader component is
    8-
    deprecated. Use the
    9-
    :doc:`DebugClassLoader provided by the Debug component </components/debug/class_loader>`.
    7+
    .. caution::
    8+
    9+
    The ``DebugClassLoader`` from the ClassLoader component was deprecated
    10+
    in Symfony 2.5 and will be removed in Symfony 3.0. Use the
    11+
    :doc:`DebugClassLoader provided by the Debug component </components/debug/class_loader>`.

    components/class_loader/psr4_class_loader.rst

    Lines changed: 0 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -4,10 +4,6 @@
    44
    The PSR-4 Class Loader
    55
    ======================
    66

    7-
    .. versionadded:: 2.5
    8-
    The :class:`Symfony\\Component\\ClassLoader\\Psr4ClassLoader` was
    9-
    introduced in Symfony 2.5.
    10-
    117
    Libraries that follow the `PSR-4`_ standard can be loaded with the ``Psr4ClassLoader``.
    128

    139
    .. note::

    components/console/changing_default_command.rst

    Lines changed: 0 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -4,10 +4,6 @@
    44
    Changing the Default Command
    55
    ============================
    66

    7-
    .. versionadded:: 2.5
    8-
    The :method:`Symfony\\Component\\Console\\Application::setDefaultCommand`
    9-
    method was introduced in Symfony 2.5.
    10-
    117
    The Console component will always run the ``ListCommand`` when no command name is
    128
    passed. In order to change the default command you just need to pass the command
    139
    name to the ``setDefaultCommand`` method::

    components/console/helpers/debug_formatter.rst

    Lines changed: 30 additions & 9 deletions
    Original file line numberDiff line numberDiff line change
    @@ -9,14 +9,23 @@ Debug Formatter Helper
    99

    1010
    The :class:`Symfony\\Component\\Console\\Helper\\DebugFormatterHelper` provides
    1111
    functions to output debug information when running an external program, for
    12-
    instance a process or HTTP request. It is included in the default helper set
    13-
    and you can get it by calling
    14-
    :method:`Symfony\\Component\\Console\\Command\\Command::getHelper`::
    12+
    instance a process or HTTP request. For example, if you used it to output
    13+
    the results of running ``ls -la`` on a UNIX system, it might output something
    14+
    like this:
    15+
    16+
    .. image:: /images/components/console/debug_formatter.png
    17+
    :align: center
    18+
    19+
    Using the debug_formatter
    20+
    -------------------------
    21+
    22+
    The formatter is included in the default helper set and you can get it by
    23+
    calling :method:`Symfony\\Component\\Console\\Command\\Command::getHelper`::
    1524

    1625
    $debugFormatter = $this->getHelper('debug_formatter');
    1726

    18-
    The formatter only formats strings, which you can use to output to the console,
    19-
    but also to log the information or do anything else.
    27+
    The formatter accepts strings and returns a formatted string, which you then
    28+
    output to the console (or even log the information or do anything else).
    2029

    2130
    All methods of this helper have an identifier as the first argument. This is a
    2231
    unique value for each program. This way, the helper can debug information for
    @@ -39,9 +48,13 @@ display information that the program is started::
    3948

    4049
    // ...
    4150
    $process = new Process(...);
    42-
    $process->run();
    4351

    44-
    $output->writeln($debugFormatter->start(spl_object_hash($process), 'Some process description'));
    52+
    $output->writeln($debugFormatter->start(
    53+
    spl_object_hash($process),
    54+
    'Some process description')
    55+
    );
    56+
    57+
    $process->run();
    4558

    4659
    This will output:
    4760

    @@ -51,7 +64,11 @@ This will output:
    5164
    5265
    You can tweak the prefix using the third argument::
    5366

    54-
    $output->writeln($debugFormatter->start(spl_object_hash($process), 'Some process description', 'STARTED');
    67+
    $output->writeln($debugFormatter->start(
    68+
    spl_object_hash($process),
    69+
    'Some process description',
    70+
    'STARTED'
    71+
    );
    5572
    // will output:
    5673
    // STARTED Some process description
    5774

    @@ -69,7 +86,11 @@ using
    6986

    7087
    $process->run(function ($type, $buffer) use ($output, $debugFormatter, $process) {
    7188
    $output->writeln(
    72-
    $debugFormatter->progress(spl_object_hash($process), $buffer, Process::ERR === $type)
    89+
    $debugFormatter->progress(
    90+
    spl_object_hash($process),
    91+
    $buffer,
    92+
    Process::ERR === $type
    93+
    )
    7394
    );
    7495
    });
    7596
    // ...
    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,9 +1,9 @@
    1-
    * :doc:`/components/console/helpers/dialoghelper`
    1+
    * :doc:`/components/console/helpers/dialoghelper` (deprecated as of 2.5)
    22
    * :doc:`/components/console/helpers/formatterhelper`
    33
    * :doc:`/components/console/helpers/processhelper`
    44
    * :doc:`/components/console/helpers/progressbar`
    5-
    * :doc:`/components/console/helpers/progresshelper`
    5+
    * :doc:`/components/console/helpers/progresshelper` (deprecated as of 2.5)
    66
    * :doc:`/components/console/helpers/questionhelper`
    77
    * :doc:`/components/console/helpers/table`
    8-
    * :doc:`/components/console/helpers/tablehelper`
    8+
    * :doc:`/components/console/helpers/tablehelper` (deprecated as of 2.5)
    99
    * :doc:`/components/console/helpers/debug_formatter` (new in 2.6)

    components/console/helpers/progressbar.rst

    Lines changed: 0 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -4,10 +4,6 @@
    44
    Progress Bar
    55
    ============
    66

    7-
    .. versionadded:: 2.5
    8-
    The Progress Bar feature was introduced in Symfony 2.5 as a replacement for
    9-
    the :doc:`Progress Helper </components/console/helpers/progresshelper>`.
    10-
    117
    When executing longer-running commands, it may be helpful to show progress
    128
    information, which updates as your command runs:
    139

    components/console/helpers/progresshelper.rst

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -7,9 +7,6 @@ Progress Helper
    77
    .. versionadded:: 2.3
    88
    The ``setCurrent`` method was introduced in Symfony 2.3.
    99

    10-
    .. versionadded:: 2.4
    11-
    The ``clear`` method was introduced in Symfony 2.4.
    12-
    1310
    .. caution::
    1411

    1512
    The Progress Helper was deprecated in Symfony 2.5 and will be removed in

    components/console/helpers/questionhelper.rst

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -4,9 +4,6 @@
    44
    Question Helper
    55
    ===============
    66

    7-
    .. versionadded:: 2.5
    8-
    The Question Helper was introduced in Symfony 2.5.
    9-
    107
    The :class:`Symfony\\Component\\Console\\Helper\\QuestionHelper` provides
    118
    functions to ask the user for more information. It is included in the default
    129
    helper set, which you can get by calling

    components/console/helpers/table.rst

    Lines changed: 0 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -4,10 +4,6 @@
    44
    Table
    55
    =====
    66

    7-
    .. versionadded:: 2.5
    8-
    The ``Table`` class was introduced in Symfony 2.5 as a replacement for the
    9-
    :doc:`Table Helper </components/console/helpers/tablehelper>`.
    10-
    117
    When building a console application it may be useful to display tabular data:
    128

    139
    .. code-block:: text

    0 commit comments

    Comments
     (0)
    0