Skip to content

Commit

Permalink
Merge branch '2.4'
Browse files Browse the repository at this point in the history
Conflicts:
	components/options_resolver.rst
  • Loading branch information
weaverryan committed Feb 4, 2014
2 parents 7e75b64 + c483ac6 commit bdc6c3f
Show file tree
Hide file tree
Showing 30 changed files with 266 additions and 110 deletions.
1 change: 1 addition & 0 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ going to need to build a form. But before you begin, first focus on the generic
{
return $this->dueDate;
}
public function setDueDate(\DateTime $dueDate = null)
{
$this->dueDate = $dueDate;
Expand Down
6 changes: 3 additions & 3 deletions book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -795,13 +795,13 @@ Gateway caches are a great way to make your website perform better. But they
have one limitation: they can only cache whole pages. If you can't cache
whole pages or if parts of a page has "more" dynamic parts, you are out of
luck. Fortunately, Symfony2 provides a solution for these cases, based on a
technology called `ESI`_, or Edge Side Includes. Akamaï wrote this specification
technology called `ESI`_, or Edge Side Includes. Akamai wrote this specification
almost 10 years ago, and it allows specific parts of a page to have a different
caching strategy than the main page.

The ESI specification describes tags you can embed in your pages to communicate
with the gateway cache. Only one tag is implemented in Symfony2, ``include``,
as this is the only useful one outside of Akamaï context:
as this is the only useful one outside of Akamai context:

.. code-block:: html

Expand Down Expand Up @@ -936,7 +936,7 @@ used ``render``.

.. note::

Symfony2 detects if a gateway cache supports ESI via another Akamaï
Symfony2 detects if a gateway cache supports ESI via another Akamai
specification that is supported out of the box by the Symfony2 reverse
proxy.

Expand Down
5 changes: 2 additions & 3 deletions book/includes/_service_container_my_mailer.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd"
>

>
<services>
<service id="my_mailer" class="Acme\HelloBundle\Mailer">
<argument>sendmail</argument>
Expand All @@ -33,4 +32,4 @@
$container->setDefinition('my_mailer', new Definition(
'Acme\HelloBundle\Mailer',
array('sendmail')
));
));
12 changes: 6 additions & 6 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -764,13 +764,13 @@ is used to enforce access.
Each ``access_control`` has several options that configure two different
things:

* (a) :ref:`should the incoming request match this access control entry <security-book-access-control-matching-options>`
* (b) :ref:`once it matches, should some sort of access restriction be enforced <security-book-access-control-enforcement-options>`:
#. :ref:`should the incoming request match this access control entry <security-book-access-control-matching-options>`
#. :ref:`once it matches, should some sort of access restriction be enforced <security-book-access-control-enforcement-options>`:

.. _security-book-access-control-matching-options:

(a) Matching Options
....................
1. Matching Options
...................

Symfony2 creates an instance of :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher`
for each ``access_control`` entry, which determines whether or not a given
Expand Down Expand Up @@ -865,8 +865,8 @@ will match any ``ip``, ``host`` or ``method``:

.. _security-book-access-control-enforcement-options:

(b) Access Enforcement
......................
2. Access Enforcement
.....................

Once Symfony2 has decided which ``access_control`` entry matches (if any),
it then *enforces* access restrictions based on the ``roles`` and ``requires_channel``
Expand Down
6 changes: 3 additions & 3 deletions book/service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ for you. In order for this to work, you must *teach* the container how to
create the ``Mailer`` service. This is done via configuration, which can
be specified in YAML, XML or PHP:

.. include includes/_service_container_my_mailer.rst.inc
.. include:: includes/_service_container_my_mailer.rst.inc

.. note::

Expand Down Expand Up @@ -643,7 +643,7 @@ which has a ``getMailerMethod()`` method on it, which will return a string
like ``sendmail`` based on some configuration. Remember that the first argument
to the ``my_mailer`` service is the simple string ``sendmail``:

.. include includes/_service_container_my_mailer.rst.inc
.. include:: includes/_service_container_my_mailer.rst.inc

But instead of hardcoding this, how could we get this value from the ``getMailerMethod()``
of the new ``mailer_configuration`` service? One way is to use an expression:
Expand Down Expand Up @@ -874,7 +874,7 @@ Now, just inject the ``request_stack``, which behaves like any normal service:
# src/Acme/HelloBundle/Resources/config/services.yml
services:
newsletter_manager:
class: "Acme\HelloBundle\Newsletter\NewsletterManager"
class: Acme\HelloBundle\Newsletter\NewsletterManager
arguments: ["@request_stack"]
.. code-block:: xml
Expand Down
2 changes: 1 addition & 1 deletion book/translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ key ``Symfony2 is great``. To find the French translation, Symfony actually
checks translation resources for several different locales:

1. First, Symfony looks for the translation in a ``fr_FR`` translation resource
(e.g. ``messages.fr_FR.xfliff``);
(e.g. ``messages.fr_FR.xliff``);

2. If it wasn't found, Symfony looks for the translation in a ``fr`` translation
resource (e.g. ``messages.fr.xliff``);
Expand Down
4 changes: 2 additions & 2 deletions components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ process is used to remove some of the differences that result from different
configuration formats, mainly the differences between YAML and XML.

The separator used in keys is typically ``_`` in YAML and ``-`` in XML. For
example, ``auto_connect`` in YAML and ``auto-connect``. The normalization would
make both of these ``auto_connect``.
example, ``auto_connect`` in YAML and ``auto-connect`` in XML.
The normalization would make both of these ``auto_connect``.

.. caution::

Expand Down
16 changes: 10 additions & 6 deletions components/console/helpers/dialoghelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ helper set, which you can get by calling
$dialog = $this->getHelperSet()->get('dialog');

All the methods inside the Dialog Helper have an
:class:`Symfony\\Component\\Console\\Output\\OutputInterface` as first the
argument, the question as the second argument and the default value as last
:class:`Symfony\\Component\\Console\\Output\\OutputInterface` as the first
argument, the question as the second argument and the default value as the last
argument.

Asking the User for confirmation
Expand Down Expand Up @@ -52,8 +52,9 @@ if you want to know a bundle name, you can add this to your command::
);

The user will be asked "Please enter the name of the bundle". They can type
some name which will be returned by the ``ask`` method. If they leave it empty,
the default value (``AcmeDemoBundle`` here) is returned.
some name which will be returned by the
:method:`Symfony\\Component\\Console\\Helper\\DialogHelper::ask` method.
If they leave it empty, the default value (``AcmeDemoBundle`` here) is returned.

Autocompletion
~~~~~~~~~~~~~~
Expand Down Expand Up @@ -222,9 +223,12 @@ this set the seventh argument to ``true``::
return $colors[$c];
}, $selected);

$output->writeln('You have just selected: ' . implode(', ', $selectedColors));
$output->writeln(
'You have just selected: ' . implode(', ', $selectedColors)
);

Now, when the user enters ``1,2``, the result will be: ``You have just selected: blue, yellow``.
Now, when the user enters ``1,2``, the result will be:
``You have just selected: blue, yellow``.

Testing a Command which expects input
-------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion components/console/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ method returns without actually printing.
The MonologBridge provides a :class:`Symfony\\Bridge\\Monolog\\Handler\\ConsoleHandler`
class that allows you to display messages on the console. This is cleaner
than wrapping your output calls in conditions. For an example use in
the Symfony Framework, see :doc:/cookbook/logging/monolog_console.
the Symfony Framework, see :doc:`/cookbook/logging/monolog_console`.

Using Command Arguments
-----------------------
Expand Down
2 changes: 1 addition & 1 deletion components/dependency_injection/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ keywords (respectively ``true``, ``false`` and ``null``):
.. code-block:: xml
<parameters>
<parameter key="mailer.send_all_in_once">false</parameters>
<parameter key="mailer.send_all_in_once">false</parameter>
</parameters>
<!-- after parsing
Expand Down
3 changes: 0 additions & 3 deletions components/dependency_injection/tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ To begin with, change the ``TransportChain`` class::
if (array_key_exists($alias, $this->transports)) {
return $this->transports[$alias];
}
else {
return;
}
}
}

Expand Down
16 changes: 9 additions & 7 deletions components/dom_crawler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ interacting with html links and forms as you traverse through the HTML tree.
.. note::

The DomCrawler will attempt to automatically fix your HTML to match the
official specification. For example, if you nest a `` <p>`` tag inside
another `` <p>`` tag, it will be moved to be a sibling of the parent tag.
official specification. For example, if you nest a ``<p>`` tag inside
another ``<p>`` tag, it will be moved to be a sibling of the parent tag.
This is expected and is part of the HTML5 spec. But if you're getting
unexpected behavior, this could be a cause. And while the DomCrawler
isn't meant to dump content, you can see the "fixed" version if your HTML
isn't meant to dump content, you can see the "fixed" version of your HTML
by :ref:`dumping it <component-dom-crawler-dumping>`.

Node Filtering
Expand All @@ -83,10 +83,12 @@ Anonymous function can be used to filter with more complex criteria::
use Symfony\Component\DomCrawler\Crawler;
// ...

$crawler = $crawler->filter('body > p')->reduce(function (Crawler $node, $i) {
// filter even nodes
return ($i % 2) == 0;
});
$crawler = $crawler
->filter('body > p')
->reduce(function (Crawler $node, $i) {
// filter even nodes
return ($i % 2) == 0;
});

To remove a node the anonymous function must return false.

Expand Down
26 changes: 14 additions & 12 deletions components/event_dispatcher/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -441,30 +441,31 @@ which returns a boolean value::
EventDispatcher aware Events and Listeners
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``EventDispatcher`` always injects a reference to itself in the passed event
object. This means that all listeners have direct access to the
``EventDispatcher`` object that notified the listener via the passed ``Event``
object's :method:`Symfony\\Component\\EventDispatcher\\Event::getDispatcher`
method.
.. versionadded:: 2.4
Since Symfony 2.4 the current event name and the ``EventDispatcher``
itself are passed to the listeners as additional arguments.

This can lead to some advanced applications of the ``EventDispatcher`` including
letting listeners dispatch other events, event chaining or even lazy loading of
more listeners into the dispatcher object. Examples follow:
The ``EventDispatcher`` always passes the dispatched event, the event's name
and a reference to itself to the listeners. This can be used in some advanced
usages of the ``EventDispatcher`` like dispatching other events in listeners,
event chaining or even lazy loading of more listeners into the dispatcher
object as shown in the following examples.

Lazy loading listeners::

use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Acme\StoreBundle\Event\StoreSubscriber;

class Foo
{
private $started = false;

public function myLazyListener(Event $event)
public function myLazyListener(Event $event, $eventName, EventDispatcherInterface $dispatcher)
{
if (false === $this->started) {
$subscriber = new StoreSubscriber();
$event->getDispatcher()->addSubscriber($subscriber);
$dispatcher->addSubscriber($subscriber);
}

$this->started = true;
Expand All @@ -476,12 +477,13 @@ Lazy loading listeners::
Dispatching another event from within a listener::

use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class Foo
{
public function myFooListener(Event $event)
public function myFooListener(Event $event, $eventName, EventDispatcherInterface $dispatcher)
{
$event->getDispatcher()->dispatch('log', $event);
$dispatcher->dispatch('log', $event);

// ... more code
}
Expand Down
4 changes: 3 additions & 1 deletion components/expression_language/caching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ Both ``evaluate()`` and ``compile()`` can handle ``ParsedExpression`` and
use Symfony\Component\ExpressionLanguage\SerializedParsedExpression;
// ...
$expression = new SerializedParsedExpression(serialize($language->parse('1 + 4')));
$expression = new SerializedParsedExpression(
serialize($language->parse('1 + 4'))
);
echo $language->evaluate($expression); // prints 5
Expand Down
Loading

0 comments on commit bdc6c3f

Please sign in to comment.