Skip to content

Commit

Permalink
Merge branch '2.4'
Browse files Browse the repository at this point in the history
Conflicts:
	book/forms.rst
  • Loading branch information
weaverryan committed Mar 7, 2014
2 parents 5cda1c7 + d6a17e7 commit e33be6d
Show file tree
Hide file tree
Showing 47 changed files with 285 additions and 99 deletions.
4 changes: 2 additions & 2 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ object that's returned from that controller::
return $response;
}

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

use Symfony\Component\HttpFoundation\Request;

Expand Down
6 changes: 3 additions & 3 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ these cases you can set the ``validation_groups`` option to ``false``::
Note that when you do that, the form will still run basic integrity checks,
for example whether an uploaded file was too large or whether non-existing
fields were submitted. If you want to suppress validation, you can use the
:ref:`POST_SUBMIT event <cookbook-dynamic-form-modification-suppressing-form-validation>`
:ref:`POST_SUBMIT event <cookbook-dynamic-form-modification-suppressing-form-validation>`.

.. index::
single: Forms; Validation groups based on submitted data
Expand Down Expand Up @@ -1811,7 +1811,7 @@ an array.
$this->get('request')->request->get('name');
Be advised, however, that in most cases using the getData() method is
Be advised, however, that in most cases using the ``getData()`` method is
a better choice, since it returns the data (usually an object) after
it's been transformed by the form framework.
Expand Down Expand Up @@ -1853,7 +1853,7 @@ but here's a short example:
.. tip::
If you are using Validation Groups, you need to either reference the
If you are using validation groups, you need to either reference the
``Default`` group when creating the form, or set the correct group on
the constraint you are adding.
Expand Down
12 changes: 9 additions & 3 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ authentication (i.e. the old-school username/password box):
realm: "Secured Demo Area"
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/admin/, roles: ROLE_ADMIN }
# Include the following line to also secure the /admin path itself
# - { path: ^/admin$, roles: ROLE_ADMIN }
providers:
in_memory:
Expand Down Expand Up @@ -79,7 +81,9 @@ authentication (i.e. the old-school username/password box):
</firewall>
<access-control>
<rule path="^/admin" role="ROLE_ADMIN" />
<rule path="^/admin/" role="ROLE_ADMIN" />
<!-- Include the following line to also secure the /admin path itself -->
<!-- <rule path="^/admin$" role="ROLE_ADMIN" /> -->
</access-control>
<provider name="in_memory">
Expand Down Expand Up @@ -108,7 +112,9 @@ authentication (i.e. the old-school username/password box):
),
),
'access_control' => array(
array('path' => '^/admin', 'role' => 'ROLE_ADMIN'),
array('path' => '^/admin/', 'role' => 'ROLE_ADMIN'),
// Include the following line to also secure the /admin path itself
// array('path' => '^/admin$', 'role' => 'ROLE_ADMIN'),
),
'providers' => array(
'in_memory' => array(
Expand Down
8 changes: 3 additions & 5 deletions book/service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1146,12 +1146,10 @@ with ``twig.extension`` and automatically registers them as extensions.
Tags, then, are a way to tell Symfony2 or other third-party bundles that
your service should be registered or used in some special way by the bundle.

The following is a list of tags available with the core Symfony2 bundles.
Each of these has a different effect on your service and many tags require
additional arguments (beyond just the ``name`` parameter).

For a list of all the tags available in the core Symfony Framework, check
out :doc:`/reference/dic_tags`.
out :doc:`/reference/dic_tags`. Each of these has a different effect on your
service and many tags require additional arguments (beyond just the ``name``
parameter).

Debugging Services
------------------
Expand Down
8 changes: 4 additions & 4 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1024,14 +1024,14 @@ stylesheets and JavaScripts that you'll need throughout your site:
{# ... #}

{% block stylesheets %}
<link href="{{ asset('/css/main.css') }}" rel="stylesheet" />
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
{% endblock %}
</head>
<body>
{# ... #}

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

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

{# ... #}
Expand Down Expand Up @@ -1314,7 +1314,7 @@ covered:
{% endfor %}
{% endblock %}

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

Expand Down
9 changes: 5 additions & 4 deletions book/translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ use somewhere in your application::
}

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

.. configuration-block::

Expand Down Expand Up @@ -646,8 +646,8 @@ Translating Database Content
----------------------------

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

Summary
-------
Expand All @@ -672,3 +672,4 @@ steps:
.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
.. _`Translatable Extension`: https://github.com/l3pp4rd/DoctrineExtensions
.. _`Translatable Bahavior`: https://github.com/KnpLabs/DoctrineBehaviors
4 changes: 2 additions & 2 deletions book/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,9 @@ entity and a new constraint group called ``Premium``:
Acme\DemoBundle\Entity\User:
properties:
name:
- NotBlank
- NotBlank: ~
creditCard:
- CardScheme
- CardScheme:
schemes: [VISA]
groups: [Premium]
Expand Down
14 changes: 3 additions & 11 deletions components/class_loader/debug_class_loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
Debugging a Class Loader
========================

The :class:`Symfony\\Component\\ClassLoader\\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
with a ``DebugClassLoader`` wrapper.

Using the ``DebugClassLoader`` is as easy as calling its static
:method:`Symfony\\Component\\ClassLoader\\DebugClassLoader::enable` method::

use Symfony\Component\ClassLoader\DebugClassLoader;
DebugClassLoader::enable();
Since Symfony 2.4, the ``DebugClassLoader`` of the Class Loader component is
deprecated. Use the
:doc:`DebugClassLoader provided by the Debug component </components/debug/class_loader>`.
2 changes: 1 addition & 1 deletion components/console/helpers/dialoghelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ from the command line, you need to overwrite the HelperSet used by the command::
return $stream;
}

By setting the inputStream of the ``DialogHelper``, you imitate what the
By setting the input stream of the ``DialogHelper``, you imitate what the
console would do internally with all user input through the cli. This way
you can test any user interaction (even complex ones) by passing an appropriate
input stream.
2 changes: 1 addition & 1 deletion components/console/helpers/tablehelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ When building a console application it may be useful to display tabular data:

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

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

$table = $app->getHelperSet()->get('table');
Expand Down
12 changes: 6 additions & 6 deletions components/console/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ verbosity levels::
}

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

.. tip::

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

.. tip::

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

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

You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or ``VALUE_OPTIONAL`` like this:
Expand Down
22 changes: 22 additions & 0 deletions components/debug/class_loader.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. index::
single: Class Loader; DebugClassLoader
single: Debug; DebugClassLoader

Debugging a Class Loader
========================

.. versionadded:: 2.4
The ``DebugClassLoader`` of the Debug component is new in Symfony 2.4.
Previously, it was located in the Class Loader 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
with a ``DebugClassLoader`` wrapper.

Using the ``DebugClassLoader`` is as easy as calling its static
:method:`Symfony\\Component\\Debug\\DebugClassLoader::enable` method::

use Symfony\Component\ClassLoader\DebugClassLoader;

DebugClassLoader::enable();
8 changes: 8 additions & 0 deletions components/debug/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Debug
=====

.. toctree::
:maxdepth: 2

introduction
class_loader
5 changes: 2 additions & 3 deletions components/debug.rst → components/debug/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ Enabling them all is as easy as it can get::
Debug::enable();

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

Read the following sections for more information about the different available
tools.
Expand Down
14 changes: 13 additions & 1 deletion components/dependency_injection/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ service by asking for the ``bar`` service like this::

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

.. tip::

In YAML, you can also use a shortcut to alias a service:

.. code-block:: yaml
services:
foo:
class: Example\Foo
bar: "@foo"
Requiring files
---------------

Expand Down Expand Up @@ -169,5 +181,5 @@ the service itself gets loaded. To do so, you can use the ``file`` directive.
$definition->setFile('%kernel.root_dir%/src/path/to/file/foo.php');
$container->setDefinition('foo', $definition);
Notice that Symfony will internally call the PHP function require_once
Notice that Symfony will internally call the PHP statement ``require_once``,
which means that your file will be included only once per request.
2 changes: 1 addition & 1 deletion components/dependency_injection/definitions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Add a method call with::

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

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

Expand Down
4 changes: 2 additions & 2 deletions components/dependency_injection/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The DependencyInjection Component
the way objects are constructed in your application.

For an introduction to Dependency Injection and service containers see
:doc:`/book/service_container`
:doc:`/book/service_container`.

Installation
------------
Expand Down Expand Up @@ -181,7 +181,7 @@ Setting Up the Container with Configuration Files
As well as setting up the services using PHP as above you can also use
configuration files. This allows you to use XML or YAML to write the definitions
for the services rather than using PHP to define the services as in the above
examples. In anything but the smallest applications it make sense to organize
examples. In anything but the smallest applications it makes sense to organize
the service definitions by moving them into one or more configuration files.
To do this you also need to install
:doc:`the Config component </components/config/introduction>`.
Expand Down
2 changes: 1 addition & 1 deletion components/dependency_injection/parentservices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The service config for these classes would look something like this:
- [setEmailFormatter, ["@my_email_formatter"]]
greeting_card_manager:
class: "%greeting_card_manager.class%"
class: "%greeting_card_manager.class%"
calls:
- [setMailer, ["@my_mailer"]]
- [setEmailFormatter, ["@my_email_formatter"]]
Expand Down
12 changes: 12 additions & 0 deletions components/dependency_injection/tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ To answer this, change the service declaration:
<tag name="acme_mailer.transport" alias="bar" />
</service>
.. code-block:: php
use Symfony\Component\DependencyInjection\Definition;
$definitionSmtp = new Definition('\Swift_SmtpTransport', array('%mailer_host%'));
$definitionSmtp->addTag('acme_mailer.transport', array('alias' => 'foo'));
$container->setDefinition('acme_mailer.transport.smtp', $definitionSmtp);
$definitionSendmail = new Definition('\Swift_SendmailTransport');
$definitionSendmail->addTag('acme_mailer.transport', array('alias' => 'bar'));
$container->setDefinition('acme_mailer.transport.sendmail', $definitionSendmail);
Notice that you've added a generic ``alias`` key to the tag. To actually
use this, update the compiler::

Expand Down
4 changes: 2 additions & 2 deletions components/http_foundation/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language
$quality = $item->getQuality();
}

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

Expand Down Expand Up @@ -420,7 +420,7 @@ method::
$response->send();
}

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

Redirecting the User
Expand Down
2 changes: 1 addition & 1 deletion components/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Components
config/index
console/index
css_selector
debug
debug/index
dependency_injection/index
dom_crawler
event_dispatcher/index
Expand Down
Loading

0 comments on commit e33be6d

Please sign in to comment.