Skip to content

Commit 032a6b4

Browse files
committed
Merge branch '2.7'
2 parents 92b10b1 + ca54d55 commit 032a6b4

File tree

11 files changed

+56
-31
lines changed

11 files changed

+56
-31
lines changed

Diff for: best_practices/templates.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ name is irrelevant because you never use it in your own code):
153153
app.twig.app_extension:
154154
class: AppBundle\Twig\AppExtension
155155
arguments: ["@markdown"]
156-
public: false
156+
public: false
157157
tags:
158158
- { name: twig.extension }
159159

Diff for: book/forms.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ an array.
18491849
You can also access POST values (in this case "name") directly through
18501850
the request object, like so::
18511851

1852-
$this->get('request')->request->get('name');
1852+
$request->request->get('name');
18531853

18541854
Be advised, however, that in most cases using the ``getData()`` method is
18551855
a better choice, since it returns the data (usually an object) after

Diff for: book/routing.rst

+29-14
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@ file:
173173
<container xmlns="http://symfony.com/schema/dic/services"
174174
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
175175
xmlns:framework="http://symfony.com/schema/dic/symfony"
176-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
177-
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
176+
xsi:schemaLocation="http://symfony.com/schema/dic/services
177+
http://symfony.com/schema/dic/services/services-1.0.xsd
178+
http://symfony.com/schema/dic/symfony
179+
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
178180
179181
<framework:config>
180182
<!-- ... -->
@@ -649,7 +651,9 @@ be added for each parameter. For example:
649651
// ...
650652
651653
/**
652-
* @Route("/blog/{page}", defaults={"page": 1}, requirements={"page": "\d+"})
654+
* @Route("/blog/{page}", defaults={"page": 1}, requirements={
655+
* "page": "\d+"
656+
* })
653657
*/
654658
public function indexAction($page)
655659
{
@@ -737,7 +741,9 @@ URL:
737741
class MainController extends Controller
738742
{
739743
/**
740-
* @Route("/{_locale}", defaults={"_locale": "en"}, requirements={"_locale": "en|fr"})
744+
* @Route("/{_locale}", defaults={"_locale": "en"}, requirements={
745+
* "_locale": "en|fr"
746+
* })
741747
*/
742748
public function homepageAction($_locale)
743749
{
@@ -1018,8 +1024,12 @@ routing system can be:
10181024
/**
10191025
* @Route(
10201026
* "/articles/{_locale}/{year}/{title}.{_format}",
1021-
* defaults: {"_format": "html"}
1022-
* requirements: {"_locale": "en|fr", "_format": "html|rss", "year": "\d+"}
1027+
* defaults: {"_format": "html"},
1028+
* requirements: {
1029+
* "_locale": "en|fr",
1030+
* "_format": "html|rss",
1031+
* "year": "\d+"
1032+
* }
10231033
* )
10241034
*/
10251035
public function showAction($_locale, $year, $title)
@@ -1096,7 +1106,7 @@ a slash. URLs matching this route might look like:
10961106
This example also highlights the special ``_format`` routing parameter.
10971107
When using this parameter, the matched value becomes the "request format"
10981108
of the ``Request`` object. Ultimately, the request format is used for such
1099-
things such as setting the ``Content-Type`` of the response (e.g. a ``json``
1109+
things as setting the ``Content-Type`` of the response (e.g. a ``json``
11001110
request format translates into a ``Content-Type`` of ``application/json``).
11011111
It can also be used in the controller to render a different template for
11021112
each value of ``_format``. The ``_format`` parameter is a very powerful way
@@ -1188,7 +1198,7 @@ each is made available as an argument to the controller method::
11881198

11891199
public function showAction($slug)
11901200
{
1191-
// ...
1201+
// ...
11921202
}
11931203

11941204
In reality, the entire ``defaults`` collection is merged with the parameter
@@ -1263,8 +1273,8 @@ configuration:
12631273
12641274
$collection = new RouteCollection();
12651275
$collection->addCollection(
1266-
// second argument is the type, which is required to enable the annotation reader
1267-
// for this resource
1276+
// second argument is the type, which is required to enable
1277+
// the annotation reader for this resource
12681278
$loader->import("@AppBundle/Controller/", "annotation")
12691279
);
12701280
@@ -1354,7 +1364,7 @@ suppose you want to prefix all routes in the AppBundle with ``/site`` (e.g.
13541364
// app/config/routing.php
13551365
use Symfony\Component\Routing\RouteCollection;
13561366
1357-
$app = $loader->import('@AppBundle/Controller/');
1367+
$app = $loader->import('@AppBundle/Controller/', 'annotation');
13581368
$app->addPrefix('/site');
13591369
13601370
$collection = new RouteCollection();
@@ -1440,7 +1450,9 @@ system. Take the ``blog_show`` example route from earlier::
14401450
// '_controller' => 'AppBundle:Blog:show',
14411451
// )
14421452

1443-
$uri = $this->get('router')->generate('blog_show', array('slug' => 'my-blog-post'));
1453+
$uri = $this->get('router')->generate('blog_show', array(
1454+
'slug' => 'my-blog-post'
1455+
));
14441456
// /blog/my-blog-post
14451457

14461458
To generate a URL, you need to specify the name of the route (e.g. ``blog_show``)
@@ -1508,7 +1520,10 @@ Generating URLs with Query Strings
15081520
The ``generate`` method takes an array of wildcard values to generate the URI.
15091521
But if you pass extra ones, they will be added to the URI as a query string::
15101522

1511-
$this->get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony'));
1523+
$this->get('router')->generate('blog', array(
1524+
'page' => 2,
1525+
'category' => 'Symfony'
1526+
));
15121527
// /blog/2?category=Symfony
15131528

15141529
Generating URLs from a Template
@@ -1549,7 +1564,7 @@ method::
15491564

15501565
From a template, in Twig, simply use the ``url()`` function (which generates an absolute URL)
15511566
rather than the ``path()`` function (which generates a relative URL). In PHP, pass ``true``
1552-
to ``generateUrl()``:
1567+
to ``generate()``:
15531568

15541569
.. configuration-block::
15551570

Diff for: book/security.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,10 @@ If you'd like to load your users via the Doctrine ORM, that's easy! See
432432
:doc:`/cookbook/security/entity_provider` for all the details.
433433

434434
.. _book-security-encoding-user-password:
435+
.. _c-encoding-the-users-password:
435436

436-
C) Encoding the Users Password
437-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
437+
C) Encoding the User's Password
438+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
438439

439440
Whether your users are stored in ``security.yml``, in a database or somewhere
440441
else, you'll want to encode their passwords. The best algorithm to use is

Diff for: book/templating.rst

+13-4
Original file line numberDiff line numberDiff line change
@@ -1035,9 +1035,14 @@ argument (or the ``version`` argument) to the desired version:
10351035

10361036
.. code-block:: html+php
10371037

1038-
<img src="<?php echo $view['assets']->getUrl('images/logo.png', null, false, '3.0') ?>" alt="Symfony!" />
1039-
1040-
If you dont give a version or pass ``null``, the default package version
1038+
<img src="<?php echo $view['assets']->getUrl(
1039+
'images/logo.png',
1040+
null,
1041+
false,
1042+
'3.0'
1043+
) ?>" alt="Symfony!" />
1044+
1045+
If you don't give a version or pass ``null``, the default package version
10411046
(from :ref:`ref-framework-assets-version`) will be used. If you pass ``false``,
10421047
versioned URL will be deactivated for this asset.
10431048

@@ -1055,7 +1060,11 @@ If you need absolute URLs for assets, you can set the third argument (or the
10551060

10561061
.. code-block:: html+php
10571062

1058-
<img src="<?php echo $view['assets']->getUrl('images/logo.png', null, true) ?>" alt="Symfony!" />
1063+
<img src="<?php echo $view['assets']->getUrl(
1064+
'images/logo.png',
1065+
null,
1066+
true
1067+
) ?>" alt="Symfony!" />
10591068

10601069
.. index::
10611070
single: Templating; Including stylesheets and JavaScripts

Diff for: book/validation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,8 @@ the string ``Default``.
847847
If you have inheritance (e.g. ``User extends BaseUser``) and you validate
848848
with the class name of the subclass (i.e. ``User``), then all constraints
849849
in the ``User`` and ``BaseUser`` will be validated. However, if you validate
850-
using the base class (i.e. ``BaseUser``), then only the constraints in
851-
the ``BaseUser`` group will be validated.
850+
using the base class (i.e. ``BaseUser``), then only the default constraints in
851+
the ``BaseUser`` class will be validated.
852852

853853
To tell the validator to use a specific group, pass one or more group names
854854
as the third argument to the ``validate()`` method::

Diff for: components/class_loader/psr4_class_loader.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ first need to configure the ``Psr4ClassLoader``:
5555
$loader->addPrefix('Symfony\\Component\\Yaml\\', __DIR__.'/lib/Yaml');
5656
$loader->register();
5757
58-
$data = Yaml::parse(__DIR__.'/config.yml');
58+
$data = Yaml::parse(file_get_contents(__DIR__.'/config.yml'));
5959
6060
First of all, the class loader is loaded manually using a ``require``
6161
statement, since there is no autoload mechanism yet. With the

Diff for: components/config/definition.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ Otherwise the result is a clean array of configuration values::
570570
use Symfony\Component\Config\Definition\Processor;
571571
use Acme\DatabaseConfiguration;
572572

573-
$config1 = Yaml::parse(__DIR__.'/src/Matthias/config/config.yml');
574-
$config2 = Yaml::parse(__DIR__.'/src/Matthias/config/config_extra.yml');
573+
$config1 = Yaml::parse(file_get_contents(__DIR__.'/src/Matthias/config/config.yml'));
574+
$config2 = Yaml::parse(file_get_contents(__DIR__.'/src/Matthias/config/config_extra.yml'));
575575

576576
$configs = array($config1, $config2);
577577

Diff for: components/config/resources.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class, which allows for recursively importing other resources::
3939
{
4040
public function load($resource, $type = null)
4141
{
42-
$configValues = Yaml::parse($resource);
42+
$configValues = Yaml::parse(file_get_contents($resource));
4343

4444
// ... handle the config values
4545

Diff for: components/serializer.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ When serializing, you can set a callback to format a specific object property::
224224
return $dateTime instanceof \DateTime
225225
? $dateTime->format(\DateTime::ISO8601)
226226
: '';
227-
}
227+
};
228228

229229
$normalizer->setCallbacks(array('createdAt' => $callback));
230230

@@ -310,7 +310,7 @@ when such a case is encountered::
310310
$org->setName('Les-Tilleuls.coop');
311311
$org->setMembers(array($member));
312312

313-
$member->setOrganization($kevin);
313+
$member->setOrganization($org);
314314

315315
echo $serializer->serialize($org, 'json'); // Throws a CircularReferenceException
316316

Diff for: quick_tour/the_architecture.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ The ``--help`` option helps you discover the usage of a command:
287287

288288
.. code-block:: bash
289289
290-
$ php app/console router:debug --help
290+
$ php app/console debug:router --help
291291
292292
Final Thoughts
293293
--------------

0 commit comments

Comments
 (0)