Skip to content

Commit e33be6d

Browse files
committed
Merge branch '2.4'
Conflicts: book/forms.rst
2 parents 5cda1c7 + d6a17e7 commit e33be6d

Some content is hidden

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

47 files changed

+285
-99
lines changed

book/controller.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ object that's returned from that controller::
475475
return $response;
476476
}
477477

478-
Notice that the `forward()` method uses the same string representation of
478+
Notice that the ``forward()`` method uses the same string representation of
479479
the controller used in the routing configuration. In this case, the target
480480
controller class will be ``HelloController`` inside some ``AcmeHelloBundle``.
481481
The array passed to the method becomes the arguments on the resulting controller.
@@ -794,7 +794,7 @@ The Request Object
794794
Besides the values of the routing placeholders, the controller also has access
795795
to the ``Request`` object. The framework injects the ``Request`` object in the
796796
controller if a variable is type-hinted with
797-
`Symfony\Component\HttpFoundation\Request`::
797+
:class:`Symfony\\Component\\HttpFoundation\\Request`::
798798

799799
use Symfony\Component\HttpFoundation\Request;
800800

book/forms.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ these cases you can set the ``validation_groups`` option to ``false``::
495495
Note that when you do that, the form will still run basic integrity checks,
496496
for example whether an uploaded file was too large or whether non-existing
497497
fields were submitted. If you want to suppress validation, you can use the
498-
:ref:`POST_SUBMIT event <cookbook-dynamic-form-modification-suppressing-form-validation>`
498+
:ref:`POST_SUBMIT event <cookbook-dynamic-form-modification-suppressing-form-validation>`.
499499

500500
.. index::
501501
single: Forms; Validation groups based on submitted data
@@ -1811,7 +1811,7 @@ an array.
18111811
18121812
$this->get('request')->request->get('name');
18131813
1814-
Be advised, however, that in most cases using the getData() method is
1814+
Be advised, however, that in most cases using the ``getData()`` method is
18151815
a better choice, since it returns the data (usually an object) after
18161816
it's been transformed by the form framework.
18171817
@@ -1853,7 +1853,7 @@ but here's a short example:
18531853
18541854
.. tip::
18551855
1856-
If you are using Validation Groups, you need to either reference the
1856+
If you are using validation groups, you need to either reference the
18571857
``Default`` group when creating the form, or set the correct group on
18581858
the constraint you are adding.
18591859

book/security.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ authentication (i.e. the old-school username/password box):
5151
realm: "Secured Demo Area"
5252
5353
access_control:
54-
- { path: ^/admin, roles: ROLE_ADMIN }
54+
- { path: ^/admin/, roles: ROLE_ADMIN }
55+
# Include the following line to also secure the /admin path itself
56+
# - { path: ^/admin$, roles: ROLE_ADMIN }
5557
5658
providers:
5759
in_memory:
@@ -79,7 +81,9 @@ authentication (i.e. the old-school username/password box):
7981
</firewall>
8082
8183
<access-control>
82-
<rule path="^/admin" role="ROLE_ADMIN" />
84+
<rule path="^/admin/" role="ROLE_ADMIN" />
85+
<!-- Include the following line to also secure the /admin path itself -->
86+
<!-- <rule path="^/admin$" role="ROLE_ADMIN" /> -->
8387
</access-control>
8488
8589
<provider name="in_memory">
@@ -108,7 +112,9 @@ authentication (i.e. the old-school username/password box):
108112
),
109113
),
110114
'access_control' => array(
111-
array('path' => '^/admin', 'role' => 'ROLE_ADMIN'),
115+
array('path' => '^/admin/', 'role' => 'ROLE_ADMIN'),
116+
// Include the following line to also secure the /admin path itself
117+
// array('path' => '^/admin$', 'role' => 'ROLE_ADMIN'),
112118
),
113119
'providers' => array(
114120
'in_memory' => array(

book/service_container.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -1146,12 +1146,10 @@ with ``twig.extension`` and automatically registers them as extensions.
11461146
Tags, then, are a way to tell Symfony2 or other third-party bundles that
11471147
your service should be registered or used in some special way by the bundle.
11481148

1149-
The following is a list of tags available with the core Symfony2 bundles.
1150-
Each of these has a different effect on your service and many tags require
1151-
additional arguments (beyond just the ``name`` parameter).
1152-
11531149
For a list of all the tags available in the core Symfony Framework, check
1154-
out :doc:`/reference/dic_tags`.
1150+
out :doc:`/reference/dic_tags`. Each of these has a different effect on your
1151+
service and many tags require additional arguments (beyond just the ``name``
1152+
parameter).
11551153

11561154
Debugging Services
11571155
------------------

book/templating.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1024,14 +1024,14 @@ stylesheets and JavaScripts that you'll need throughout your site:
10241024
{# ... #}
10251025

10261026
{% block stylesheets %}
1027-
<link href="{{ asset('/css/main.css') }}" rel="stylesheet" />
1027+
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
10281028
{% endblock %}
10291029
</head>
10301030
<body>
10311031
{# ... #}
10321032

10331033
{% block javascripts %}
1034-
<script src="{{ asset('/js/main.js') }}"></script>
1034+
<script src="{{ asset('js/main.js') }}"></script>
10351035
{% endblock %}
10361036
</body>
10371037
</html>
@@ -1049,7 +1049,7 @@ page. From inside that contact page's template, do the following:
10491049
{% block stylesheets %}
10501050
{{ parent() }}
10511051

1052-
<link href="{{ asset('/css/contact.css') }}" rel="stylesheet" />
1052+
<link href="{{ asset('css/contact.css') }}" rel="stylesheet" />
10531053
{% endblock %}
10541054

10551055
{# ... #}
@@ -1314,7 +1314,7 @@ covered:
13141314
{% endfor %}
13151315
{% endblock %}
13161316

1317-
Notice that this template extends the section template -(``AcmeBlogBundle::layout.html.twig``)
1317+
Notice that this template extends the section template (``AcmeBlogBundle::layout.html.twig``)
13181318
which in-turn extends the base application layout (``::base.html.twig``).
13191319
This is the common three-level inheritance model.
13201320

book/translation.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ use somewhere in your application::
546546
}
547547

548548
Add constraints though any of the supported methods. Set the message option to the
549-
translation source text. For example, to guarantee that the $name property is not
550-
empty, add the following:
549+
translation source text. For example, to guarantee that the ``$name`` property is
550+
not empty, add the following:
551551

552552
.. configuration-block::
553553

@@ -646,8 +646,8 @@ Translating Database Content
646646
----------------------------
647647

648648
The translation of database content should be handled by Doctrine through
649-
the `Translatable Extension`_. For more information, see the documentation
650-
for that library.
649+
the `Translatable Extension`_ or the `Translatable Bahavior`_ (PHP 5.4+).
650+
For more information, see the documentation for thes libraries.
651651

652652
Summary
653653
-------
@@ -672,3 +672,4 @@ steps:
672672
.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
673673
.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
674674
.. _`Translatable Extension`: https://github.com./l3pp4rd/DoctrineExtensions
675+
.. _`Translatable Bahavior`: https://github.com./KnpLabs/DoctrineBehaviors

book/validation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,9 @@ entity and a new constraint group called ``Premium``:
985985
Acme\DemoBundle\Entity\User:
986986
properties:
987987
name:
988-
- NotBlank
988+
- NotBlank: ~
989989
creditCard:
990-
- CardScheme
990+
- CardScheme:
991991
schemes: [VISA]
992992
groups: [Premium]
993993

components/class_loader/debug_class_loader.rst

+3-11
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
Debugging a Class Loader
55
========================
66

7-
The :class:`Symfony\\Component\\ClassLoader\\DebugClassLoader` attempts to
8-
throw more helpful exceptions when a class isn't found by the registered
9-
autoloaders. All autoloaders that implement a ``findFile()`` method are replaced
10-
with a ``DebugClassLoader`` wrapper.
11-
12-
Using the ``DebugClassLoader`` is as easy as calling its static
13-
:method:`Symfony\\Component\\ClassLoader\\DebugClassLoader::enable` method::
14-
15-
use Symfony\Component\ClassLoader\DebugClassLoader;
16-
17-
DebugClassLoader::enable();
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>`.

components/console/helpers/dialoghelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ from the command line, you need to overwrite the HelperSet used by the command::
264264
return $stream;
265265
}
266266

267-
By setting the inputStream of the ``DialogHelper``, you imitate what the
267+
By setting the input stream of the ``DialogHelper``, you imitate what the
268268
console would do internally with all user input through the cli. This way
269269
you can test any user interaction (even complex ones) by passing an appropriate
270270
input stream.

components/console/helpers/tablehelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ When building a console application it may be useful to display tabular data:
1111

1212
.. image:: /images/components/console/table.png
1313

14-
To display table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`,
14+
To display a table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`,
1515
set headers, rows and render::
1616

1717
$table = $app->getHelperSet()->get('table');

components/console/introduction.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ verbosity levels::
225225
}
226226

227227
When the quiet level is used, all output is suppressed as the default
228-
:method:`Symfony\Component\Console\Output::write <Symfony\\Component\\Console\\Output\\Output::write>`
229-
method returns without actually printing.
228+
:method:`Symfony\\Component\\Console\\Output\\Output::write` method returns
229+
without actually printing.
230230

231231
.. tip::
232232

@@ -321,13 +321,13 @@ Unlike arguments, options are not ordered (meaning you can specify them in any
321321
order) and are specified with two dashes (e.g. ``--yell`` - you can also
322322
declare a one-letter shortcut that you can call with a single dash like
323323
``-y``). Options are *always* optional, and can be setup to accept a value
324-
(e.g. ``dir=src``) or simply as a boolean flag without a value (e.g.
325-
``yell``).
324+
(e.g. ``--dir=src``) or simply as a boolean flag without a value (e.g.
325+
``--yell``).
326326

327327
.. tip::
328328

329329
It is also possible to make an option *optionally* accept a value (so that
330-
``--yell`` or ``yell=loud`` work). Options can also be configured to
330+
``--yell`` or ``--yell=loud`` work). Options can also be configured to
331331
accept an array of values.
332332

333333
For example, add a new option to the command that can be used to specify
@@ -379,7 +379,7 @@ Option Value
379379
InputOption::VALUE_IS_ARRAY This option accepts multiple values (e.g. ``--dir=/foo --dir=/bar``)
380380
InputOption::VALUE_NONE Do not accept input for this option (e.g. ``--yell``)
381381
InputOption::VALUE_REQUIRED This value is required (e.g. ``--iterations=5``), the option itself is still optional
382-
InputOption::VALUE_OPTIONAL This option may or may not have a value (e.g. ``yell`` or ``yell=loud``)
382+
InputOption::VALUE_OPTIONAL This option may or may not have a value (e.g. ``--yell`` or ``--yell=loud``)
383383
=========================== =====================================================================================
384384

385385
You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or ``VALUE_OPTIONAL`` like this:

components/debug/class_loader.rst

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. index::
2+
single: Class Loader; DebugClassLoader
3+
single: Debug; DebugClassLoader
4+
5+
Debugging a Class Loader
6+
========================
7+
8+
.. versionadded:: 2.4
9+
The ``DebugClassLoader`` of the Debug component is new in Symfony 2.4.
10+
Previously, it was located in the Class Loader component.
11+
12+
The :class:`Symfony\\Component\\Debug\\DebugClassLoader` attempts to
13+
throw more helpful exceptions when a class isn't found by the registered
14+
autoloaders. All autoloaders that implement a ``findFile()`` method are replaced
15+
with a ``DebugClassLoader`` wrapper.
16+
17+
Using the ``DebugClassLoader`` is as easy as calling its static
18+
:method:`Symfony\\Component\\Debug\\DebugClassLoader::enable` method::
19+
20+
use Symfony\Component\ClassLoader\DebugClassLoader;
21+
22+
DebugClassLoader::enable();

components/debug/index.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Debug
2+
=====
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
introduction
8+
class_loader

components/debug.rst renamed to components/debug/introduction.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ Enabling them all is as easy as it can get::
3030
Debug::enable();
3131

3232
The :method:`Symfony\\Component\\Debug\\Debug::enable` method registers an
33-
error handler and an exception handler. If the :doc:`ClassLoader component
34-
</components/class_loader/introduction>` is available, a special class loader
35-
is also registered.
33+
error handler, an exception handler and
34+
:doc:`a special class loader </components/debug/class_loader>`.
3635

3736
Read the following sections for more information about the different available
3837
tools.

components/dependency_injection/advanced.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,18 @@ service by asking for the ``bar`` service like this::
142142

143143
$container->get('bar'); // Would return the foo service
144144

145+
.. tip::
146+
147+
In YAML, you can also use a shortcut to alias a service:
148+
149+
.. code-block:: yaml
150+
151+
services:
152+
foo:
153+
class: Example\Foo
154+
bar: "@foo"
155+
156+
145157
Requiring files
146158
---------------
147159

@@ -169,5 +181,5 @@ the service itself gets loaded. To do so, you can use the ``file`` directive.
169181
$definition->setFile('%kernel.root_dir%/src/path/to/file/foo.php');
170182
$container->setDefinition('foo', $definition);
171183
172-
Notice that Symfony will internally call the PHP function require_once
184+
Notice that Symfony will internally call the PHP statement ``require_once``,
173185
which means that your file will be included only once per request.

components/dependency_injection/definitions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Add a method call with::
104104

105105
$definition->addMethodCall($method, $arguments);
106106

107-
Where ``$method`` is the method name and $arguments is an array of the arguments
107+
Where ``$method`` is the method name and ``$arguments`` is an array of the arguments
108108
to call the method with. The arguments can be strings, arrays, parameters or
109109
service ids as with the constructor arguments.
110110

components/dependency_injection/introduction.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The DependencyInjection Component
99
the way objects are constructed in your application.
1010

1111
For an introduction to Dependency Injection and service containers see
12-
:doc:`/book/service_container`
12+
:doc:`/book/service_container`.
1313

1414
Installation
1515
------------
@@ -181,7 +181,7 @@ Setting Up the Container with Configuration Files
181181
As well as setting up the services using PHP as above you can also use
182182
configuration files. This allows you to use XML or YAML to write the definitions
183183
for the services rather than using PHP to define the services as in the above
184-
examples. In anything but the smallest applications it make sense to organize
184+
examples. In anything but the smallest applications it makes sense to organize
185185
the service definitions by moving them into one or more configuration files.
186186
To do this you also need to install
187187
:doc:`the Config component </components/config/introduction>`.

components/dependency_injection/parentservices.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The service config for these classes would look something like this:
6868
- [setEmailFormatter, ["@my_email_formatter"]]
6969
7070
greeting_card_manager:
71-
class: "%greeting_card_manager.class%"
71+
class: "%greeting_card_manager.class%"
7272
calls:
7373
- [setMailer, ["@my_mailer"]]
7474
- [setEmailFormatter, ["@my_email_formatter"]]

components/dependency_injection/tags.rst

+12
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,18 @@ To answer this, change the service declaration:
235235
<tag name="acme_mailer.transport" alias="bar" />
236236
</service>
237237
238+
.. code-block:: php
239+
240+
use Symfony\Component\DependencyInjection\Definition;
241+
242+
$definitionSmtp = new Definition('\Swift_SmtpTransport', array('%mailer_host%'));
243+
$definitionSmtp->addTag('acme_mailer.transport', array('alias' => 'foo'));
244+
$container->setDefinition('acme_mailer.transport.smtp', $definitionSmtp);
245+
246+
$definitionSendmail = new Definition('\Swift_SendmailTransport');
247+
$definitionSendmail->addTag('acme_mailer.transport', array('alias' => 'bar'));
248+
$container->setDefinition('acme_mailer.transport.sendmail', $definitionSendmail);
249+
238250
Notice that you've added a generic ``alias`` key to the tag. To actually
239251
use this, update the compiler::
240252

components/http_foundation/introduction.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language
261261
$quality = $item->getQuality();
262262
}
263263

264-
// accepts items are sorted by descending quality
264+
// Accept header items are sorted by descending quality
265265
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))
266266
->all();
267267

@@ -420,7 +420,7 @@ method::
420420
$response->send();
421421
}
422422

423-
If the Response is not modified, it sets the status code to 304 and remove the
423+
If the Response is not modified, it sets the status code to 304 and removes the
424424
actual response content.
425425

426426
Redirecting the User

components/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The Components
99
config/index
1010
console/index
1111
css_selector
12-
debug
12+
debug/index
1313
dependency_injection/index
1414
dom_crawler
1515
event_dispatcher/index

0 commit comments

Comments
 (0)