Skip to content

Commit

Permalink
Remove more Symfony 2.x references
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Feb 8, 2016
1 parent 52d020c commit e92c48f
Show file tree
Hide file tree
Showing 89 changed files with 90 additions and 1,243 deletions.
4 changes: 2 additions & 2 deletions best_practices/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Canonical Parameters
Define all your application's parameters in the
``app/config/parameters.yml.dist`` file.

Since version 2.3, Symfony includes a configuration file called ``parameters.yml.dist``,
which stores the canonical list of configuration parameters for the application.
Symfony includes a configuration file called ``parameters.yml.dist``, which
stores the canonical list of configuration parameters for the application.

Whenever a new configuration parameter is defined for the application, you
should also add it to this file and submit the changes to your version control
Expand Down
3 changes: 1 addition & 2 deletions best_practices/creating-the-project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ ProductBundle, then there's no advantage to having two separate bundles.
Create only one bundle called AppBundle for your application logic

Implementing a single AppBundle bundle in your projects will make your code
more concise and easier to understand. Starting in Symfony 2.6, the official
Symfony documentation uses the AppBundle name.
more concise and easier to understand.

.. note::

Expand Down
7 changes: 4 additions & 3 deletions best_practices/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ makes them easier to re-use later.

Add buttons in the templates, not in the form classes or the controllers.

Since Symfony 2.3, you can add buttons as fields on your form. This is a nice
way to simplify the template that renders your form. But if you add the buttons
directly in your form class, this would effectively limit the scope of that form:
The Symfony Form component allows you to add buttons as fields on your form.
This is a nice way to simplify the template that renders your form. But if you
add the buttons directly in your form class, this would effectively limit the
scope of that form:

.. code-block:: php
Expand Down
6 changes: 3 additions & 3 deletions best_practices/i18n.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ Of all the available translation formats, only XLIFF and gettext have broad
support in the tools used by professional translators. And since it's based
on XML, you can validate XLIFF file contents as you write them.

Symfony 2.6 added support for notes inside XLIFF files, making them more
user-friendly for translators. At the end, good translations are all about
context, and these XLIFF notes allow you to define that context.
Symfony supports notes in XLIFF files, making them more user-friendly for
translators. At the end, good translations are all about context, and these
XLIFF notes allow you to define that context.

.. tip::

Expand Down
1 change: 0 additions & 1 deletion best_practices/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ the same ``getAuthorEmail`` logic you used above:
use Symfony\Component\Security\Core\User\UserInterface;
use AppBundle\Entity\Post;
// Voter class requires Symfony 2.8 or higher version
class PostVoter extends Voter
{
const CREATE = 'create';
Expand Down
3 changes: 0 additions & 3 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,6 @@ to the ``form()`` or the ``form_start()`` helper:

<!-- app/Resources/views/default/newAction.html.php -->
<?php echo $view['form']->start($form, array(
// The path() method was introduced in Symfony 2.8. Prior to 2.8,
// you had to use generate().
'action' => $view['router']->path('target_route'),
'method' => 'GET',
)) ?>
Expand Down Expand Up @@ -1951,4 +1949,3 @@ Learn more from the Cookbook
.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
.. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery
.. _`view on GitHub`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form
.. _`2.8 UPGRADE Log`: https://github.com/symfony/symfony/blob/2.8/UPGRADE-2.8.md#form
2 changes: 1 addition & 1 deletion book/from_flat_php_to_symfony2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ content:
{
"require": {
"symfony/symfony": "2.6.*"
"symfony/symfony": "3.0.*"
},
"autoload": {
"files": ["model.php","controllers.php"]
Expand Down
7 changes: 1 addition & 6 deletions book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1095,12 +1095,7 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags:

<!-- ... or a URL -->
<?php echo $view['actions']->render(
// The url() method was introduced in Symfony 2.8. Prior to 2.8,
// you had to use generate($name, $parameters, UrlGeneratorInterface::ABSOLUTE_URL)
$view['router']->url(
'latest_news',
array('maxPerPage' => 5),
),
$view['router']->url('latest_news', array('maxPerPage' => 5)),
array('strategy' => 'esi'),
) ?>

Expand Down
2 changes: 1 addition & 1 deletion book/page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,6 @@ There's also a :doc:`Cookbook </cookbook/index>` *packed* with more advanced
Have fun!

.. _`Joyful Development with Symfony`: http://knpuniversity.com/screencast/symfony/first-page
.. _`app/Resources/views/base.html.twig`: https://github.com/symfony/symfony-standard/blob/2.7/app/Resources/views/base.html.twig
.. _`app/Resources/views/base.html.twig`: https://github.com/symfony/symfony-standard/blob/3.0/app/Resources/views/base.html.twig
.. _`Composer`: https://getcomposer.org
.. _`find open source bundles`: http://knpbundles.com
14 changes: 1 addition & 13 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ else, you'll want to encode their passwords. The best algorithm to use is
));
Of course, your users' passwords now need to be encoded with this exact algorithm.
For hardcoded users, since 2.7 you can use the built-in command:
For hardcoded users, you can use the built-in command:

.. code-block:: bash
Expand Down Expand Up @@ -894,18 +894,6 @@ the built-in ``is_granted()`` helper function:
<a href="...">Delete</a>
<?php endif ?>

.. note::

In Symfony versions previous to 2.8, using the ``is_granted()`` function
in a page that wasn't behind a firewall resulted in an exception. That's why
you also needed to check first for the existence of the user:

.. code-block:: html+twig

{% if app.user and is_granted('ROLE_ADMIN') %}

Starting from Symfony 2.8, the ``app.user and ...`` check is no longer needed.

Securing other Services
.......................

Expand Down
12 changes: 7 additions & 5 deletions book/service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -811,13 +811,15 @@ Injecting the dependency by the setter method just needs a change of syntax:
"property injection".

.. _book-container-request-stack:
.. _injecting-the-request:

Injecting the Request
~~~~~~~~~~~~~~~~~~~~~
Accessing the Request in a Service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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`
Whenever you need to access the current request in a service, you can either
add it as an argument to the methods that need the request or inject the
``request_stack`` service and access the ``Request`` by calling the
:method:`Symfony\\Component\\HttpFoundation\\RequestStack::getCurrentRequest`
method::

namespace Acme\HelloBundle\Newsletter;
Expand Down
17 changes: 0 additions & 17 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,6 @@ tags:
array('renderer' => 'hinclude')
) ?>
<!-- The url() method was introduced in Symfony 2.8. Prior to 2.8, you
had to use generate() with UrlGeneratorInterface::ABSOLUTE_URL
passed as the third argument. -->
<?php echo $view['actions']->render(
$view['router']->url('...'),
array('renderer' => 'hinclude')
Expand Down Expand Up @@ -917,8 +914,6 @@ To link to the page, just use the ``path`` Twig function and refer to the route:

.. code-block:: html+php

<!-- The path() method was introduced in Symfony 2.8. Prior to 2.8, you
had to use generate(). -->
<a href="<?php echo $view['router']->path('_welcome') ?>">Home</a>

As expected, this will generate the URL ``/``. Now, for a more complicated
Expand Down Expand Up @@ -998,8 +993,6 @@ correctly:

<!-- app/Resources/views/Article/recent_list.html.php -->
<?php foreach ($articles in $article): ?>
<!-- The path() method was introduced in Symfony 2.8. Prior to 2.8,
you had to use generate(). -->
<a href="<?php echo $view['router']->path('article_show', array(
'slug' => $article->getSlug(),
)) ?>">
Expand All @@ -1024,12 +1017,6 @@ correctly:
array()
) ?>">Home</a>

.. versionadded:: 2.8
The ``url()`` PHP templating helper was introduced in Symfony 2.8. Prior
to 2.8, you had to use the ``generate()`` helper method with
``Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL``
passed as the third argument.

.. index::
single: Templating; Linking to assets

Expand Down Expand Up @@ -1234,8 +1221,6 @@ is a :class:`Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables`
instance which will give you access to some application specific variables
automatically:

``app.security`` (deprecated as of 2.6)
The security context.
``app.user``
The current user object.
``app.request``
Expand Down Expand Up @@ -1693,8 +1678,6 @@ key in the parameter hash:

.. code-block:: html+php

<!-- The path() method was introduced in Symfony 2.8. Prior to 2.8, you
had to use generate(). -->
<a href="<?php echo $view['router']->path('article_show', array(
'id' => 123,
'_format' => 'pdf',
Expand Down
13 changes: 0 additions & 13 deletions book/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -877,12 +877,8 @@ the class name or the string ``Default``.
To tell the validator to use a specific group, pass one or more group names
as the third argument to the ``validate()`` method::

// If you're using the new 2.5 validation API (you probably are!)
$errors = $validator->validate($author, null, array('registration'));

// If you're using the old 2.4 validation API, pass the group names as the second argument
// $errors = $validator->validate($author, array('registration'));

If no groups are specified, all constraints that belong to the group ``Default``
will be applied.

Expand Down Expand Up @@ -1243,20 +1239,11 @@ it looks like this::
$emailConstraint->message = 'Invalid email address';

// use the validator to validate the value
// If you're using the new 2.5 validation API (you probably are!)
$errorList = $this->get('validator')->validate(
$email,
$emailConstraint
);

// If you're using the old 2.4 validation API
/*
$errorList = $this->get('validator')->validateValue(
$email,
$emailConstraint
);
*/

if (0 === count($errorList)) {
// ... this IS a valid email address, do something
} else {
Expand Down
2 changes: 1 addition & 1 deletion components/class_loader/debug_class_loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Debugging a Class Loader
.. caution::

The ``DebugClassLoader`` from the ClassLoader component was deprecated
in Symfony 2.5 and will be removed in Symfony 3.0. Use the
in Symfony 2.5 and removed in Symfony 3.0. Use the
:doc:`DebugClassLoader provided by the Debug component </components/debug/class_loader>`.
4 changes: 0 additions & 4 deletions components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,6 @@ and in XML:
<!-- entries-per-page: This value is only used for the search results page. -->
<config entries-per-page="25" />
.. versionadded:: 2.6
Since Symfony 2.6, the info will also be added to the exception message
when an invalid type is given.

Optional Sections
-----------------

Expand Down
Loading

0 comments on commit e92c48f

Please sign in to comment.