Skip to content

Commit 5471a32

Browse files
committed
Merge branch '2.3'
2 parents 3d27f53 + a78d1a4 commit 5471a32

File tree

14 files changed

+351
-127
lines changed

14 files changed

+351
-127
lines changed

book/internals.rst

Lines changed: 2 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -629,104 +629,8 @@ As the profiler adds some overhead, you might want to enable it only under
629629
certain circumstances in the production environment. The ``only-exceptions``
630630
settings limits profiling to 500 pages, but what if you want to get
631631
information when the client IP comes from a specific address, or for a limited
632-
portion of the website? You can use a request matcher:
633-
634-
.. configuration-block::
635-
636-
.. code-block:: yaml
637-
638-
# enables the profiler only for request coming
639-
# for the 192.168.0.0 network
640-
framework:
641-
profiler:
642-
matcher: { ip: 192.168.0.0/24 }
643-
644-
# enables the profiler only for the /admin URLs
645-
framework:
646-
profiler:
647-
matcher: { path: "^/admin/" }
648-
649-
# combine rules
650-
framework:
651-
profiler:
652-
matcher: { ip: 192.168.0.0/24, path: "^/admin/" }
653-
654-
# use a custom matcher instance defined in
655-
# the "custom_matcher" service
656-
framework:
657-
profiler:
658-
matcher: { service: custom_matcher }
659-
660-
.. code-block:: xml
661-
662-
<!--
663-
enables the profiler only for request coming
664-
for the 192.168.0.0 network
665-
-->
666-
<framework:config>
667-
<framework:profiler>
668-
<framework:matcher ip="192.168.0.0/24" />
669-
</framework:profiler>
670-
</framework:config>
671-
672-
<!-- enables the profiler only for the /admin URLs -->
673-
<framework:config>
674-
<framework:profiler>
675-
<framework:matcher path="^/admin/" />
676-
</framework:profiler>
677-
</framework:config>
678-
679-
<!-- combine rules -->
680-
<framework:config>
681-
<framework:profiler>
682-
<framework:matcher ip="192.168.0.0/24" path="^/admin/" />
683-
</framework:profiler>
684-
</framework:config>
685-
686-
<!--
687-
use a custom matcher instance defined in
688-
the "custom_matcher" service
689-
-->
690-
<framework:config>
691-
<framework:profiler>
692-
<framework:matcher service="custom_matcher" />
693-
</framework:profiler>
694-
</framework:config>
695-
696-
.. code-block:: php
697-
698-
// enables the profiler only for request coming
699-
// for the 192.168.0.0 network
700-
$container->loadFromExtension('framework', array(
701-
'profiler' => array(
702-
'matcher' => array('ip' => '192.168.0.0/24'),
703-
),
704-
));
705-
706-
// enables the profiler only for the /admin URLs
707-
$container->loadFromExtension('framework', array(
708-
'profiler' => array(
709-
'matcher' => array('path' => '^/admin/'),
710-
),
711-
));
712-
713-
// combine rules
714-
$container->loadFromExtension('framework', array(
715-
'profiler' => array(
716-
'matcher' => array(
717-
'ip' => '192.168.0.0/24',
718-
'path' => '^/admin/',
719-
),
720-
),
721-
));
722-
723-
// use a custom matcher instance defined in
724-
// the "custom_matcher" service
725-
$container->loadFromExtension('framework', array(
726-
'profiler' => array(
727-
'matcher' => array('service' => 'custom_matcher'),
728-
),
729-
));
632+
portion of the website? You can use a Profiler Matcher, learn more about that
633+
in ":doc:`/cookbook/profiler/matchers`".
730634

731635
Learn more from the Cookbook
732636
----------------------------

book/routing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ By default, the router will generate relative URLs (e.g. ``/blog``). To generate
12011201
an absolute URL, simply pass ``true`` to the third argument of the ``generate()``
12021202
method::
12031203

1204-
$router->generate('blog_show', array('slug' => 'my-blog-post'), true);
1204+
$this->get('router')->generate('blog_show', array('slug' => 'my-blog-post'), true);
12051205
// http://www.example.com/blog/my-blog-post
12061206

12071207
.. note::
@@ -1212,7 +1212,7 @@ method::
12121212
scripts run from the command line, you'll need to manually set the desired
12131213
host on the ``RequestContext`` object::
12141214

1215-
$router->getContext()->setHost('www.example.com');
1215+
$this->get('router')->getContext()->setHost('www.example.com');
12161216

12171217
.. index::
12181218
single: Routing; Generating URLs in a template
@@ -1223,7 +1223,7 @@ Generating URLs with Query Strings
12231223
The ``generate`` method takes an array of wildcard values to generate the URI.
12241224
But if you pass extra ones, they will be added to the URI as a query string::
12251225

1226-
$router->generate('blog', array('page' => 2, 'category' => 'Symfony'));
1226+
$this->get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony'));
12271227
// /blog/2?category=Symfony
12281228

12291229
Generating URLs from a template
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.. index::
2+
single: Event Dispatcher; Immutable
3+
4+
The Immutable Event Dispatcher
5+
==============================
6+
7+
.. versionadded:: 2.1
8+
This feature was added in Symfony 2.1.
9+
10+
The :class:`Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher` is
11+
a locked or frozen event dispatcher. The dispatcher cannot register new
12+
listeners or subscribers.
13+
14+
The ``ImmutableEventDispatcher`` takes another event dispatcher with all the
15+
listeners and subscribers. The immutable dispatcher is just a proxy of this
16+
original dispatcher.
17+
18+
To use it, first create a normal dispatcher (``EventDispatcher`` or
19+
``ContainerAwareEventDispatcher``) and register some listeners or
20+
subscribers::
21+
22+
use Symfony\Component\EventDispatcher\EventDispatcher;
23+
24+
$dispatcher = new EventDispatcher();
25+
$dispatcher->addListener('foo.action', function ($event) {
26+
// ...
27+
});
28+
29+
// ...
30+
31+
Now, inject that into an ``ImmutableEventDispatcher``::
32+
33+
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
34+
// ...
35+
36+
$immutableDispatcher = new ImmutableEventDispatcher($dispatcher);
37+
38+
You'll need to use this new dispatcher in your project.
39+
40+
If you are trying to execute one of the methods which modifies the dispatcher
41+
(e.g. ``addListener``), a ``BadMethodCallException`` is thrown.

components/event_dispatcher/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ Event Dispatcher
55
:maxdepth: 2
66

77
introduction
8-
generic_event
98
container_aware_dispatcher
9+
generic_event
10+
immutable_dispatcher

components/event_dispatcher/introduction.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,15 @@ part of the listener's processing logic::
588588
}
589589
}
590590

591+
Other Dispatchers
592+
-----------------
593+
594+
Besides the commonly used ``EventDispatcher``, the component comes with 2
595+
other dispatchers:
596+
597+
* :doc:`/components/event_dispatcher/container_aware_dispatcher`
598+
* :doc:`/components/event_dispatcher/immutable_dispatcher`
599+
591600
.. _Mediator: http://en.wikipedia.org/wiki/Mediator_pattern
592601
.. _Closures: http://php.net/manual/en/functions.anonymous.php
593602
.. _PHP callable: http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback

components/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
* :doc:`/components/event_dispatcher/introduction`
5252
* :doc:`/components/event_dispatcher/container_aware_dispatcher`
5353
* :doc:`/components/event_dispatcher/generic_event`
54+
* :doc:`/components/event_dispatcher/immutable_dispatcher`
5455

5556
* **Filesystem**
5657

contributing/code/patches.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ Choose the right Branch
107107
Before working on a patch, you must determine on which branch you need to
108108
work. The branch should be based on the `master` branch if you want to add a
109109
new feature. But if you want to fix a bug, use the oldest but still maintained
110-
version of Symfony where the bug happens (like `2.1`).
110+
version of Symfony where the bug happens (like `2.2`).
111111

112112
.. note::
113113

114114
All bug fixes merged into maintenance branches are also merged into more
115115
recent branches on a regular basis. For instance, if you submit a patch
116-
for the `2.1` branch, the patch will also be applied by the core team on
116+
for the `2.2` branch, the patch will also be applied by the core team on
117117
the `master` branch.
118118

119119
Create a Topic Branch
@@ -126,18 +126,18 @@ topic branch:
126126
127127
$ git checkout -b BRANCH_NAME master
128128
129-
Or, if you want to provide a bugfix for the 2.1 branch, first track the remote
130-
`2.1` branch locally:
129+
Or, if you want to provide a bugfix for the 2.2 branch, first track the remote
130+
`2.2` branch locally:
131131

132132
.. code-block:: bash
133133
134-
$ git checkout -t origin/2.1
134+
$ git checkout -t origin/2.2
135135
136-
Then create a new branch off the 2.1 branch to work on the bugfix:
136+
Then create a new branch off the 2.2 branch to work on the bugfix:
137137

138138
.. code-block:: bash
139139
140-
$ git checkout -b BRANCH_NAME 2.1
140+
$ git checkout -b BRANCH_NAME 2.2
141141
142142
.. tip::
143143

@@ -230,7 +230,7 @@ while to finish your changes):
230230
231231
.. tip::
232232

233-
Replace `master` with `2.1` if you are working on a bugfix
233+
Replace `master` with `2.2` if you are working on a bugfix
234234

235235
When doing the ``rebase`` command, you might have to fix merge conflicts.
236236
``git status`` will show you the *unmerged* files. Resolve all the conflicts,
@@ -254,8 +254,8 @@ You can now make a pull request on the ``symfony/symfony`` Github repository.
254254

255255
.. tip::
256256

257-
Take care to point your pull request towards ``symfony:2.1`` if you want
258-
the core team to pull a bugfix based on the 2.1 branch.
257+
Take care to point your pull request towards ``symfony:2.2`` if you want
258+
the core team to pull a bugfix based on the 2.2 branch.
259259

260260
To ease the core team work, always include the modified components in your
261261
pull request message, like in:

cookbook/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
* :doc:`/cookbook/profiler/index`
103103

104104
* :doc:`/cookbook/profiler/data_collector`
105+
* :doc:`/cookbook/profiler/matchers`
105106

106107
* :doc:`/cookbook/request/index`
107108

cookbook/profiler/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Profiler
55
:maxdepth: 2
66

77
data_collector
8+
matchers

0 commit comments

Comments
 (0)