8000 Merge branch '2.8' into 3.2 · symfony/symfony-docs@6737f80 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6737f80

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: [#8211] minor reword Reword Update language.rst Mention lazy loading for Doctrine event listeners Documented the WebProfilerBundle configuration Typo fixed in a doctrine docs [#8245] link text directly Link to '"creating a reproducer" in "reporting a bug" Removed an extra line Updated xml config [Form] [RepeatedType] Update "type" default value Fixed entity manager service name [#7912] remove obsolete comment Removed tabs in 2.8 docs Removed tabs in 2.7 docs Added docs for "date" and "number_format" Twig options
2 parents 556c721 + 838ba1d commit 6737f80

File tree

13 files changed

+253
-58
lines changed

13 files changed

+253
-58
lines changed

components/form.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ builder:
476476
);
477477
478478
$form = $this->createFormBuilder($defaults)
479-
->add('task', TextType::class)
480-
->add('dueDate', DateType::class)
479+
->add('task', TextType::class)
480+
->add('dueDate', DateType::class)
481481
->getForm();
482482
483483
// ...
@@ -616,8 +616,8 @@ method:
616616
public function newAction(Request $request)
617617
{
618618
$form = $this->createFormBuilder()
619-
->add('task', TextType::class)
620-
->add('dueDate', DateType::class)
619+
->add('task', TextType::class)
620+
->add('dueDate', DateType::class)
621621
->getForm();
622622
623623
$form->handleRequest($request);
@@ -694,10 +694,10 @@ option when building each field:
694694
public function newAction(Request $request)
695695
{
696696
$form = $this->createFormBuilder()
697-
->add('task', TextType::class, array(
697+
->add('task', TextType::class, array(
698698
'constraints' => new NotBlank(),
699699
))
700-
->add('dueDate', DateType::class, array(
700+
->add('dueDate', DateType::class, array(
701701
'constraints' => array(
702702
new NotBlank(),
703703
new Type(\DateTime::class),

contributing/code/bugs.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ If your problem definitely looks like a bug, report it using the official bug
2626
* Describe the steps needed to reproduce the bug with short code examples
2727
(providing a unit test that illustrates the bug is best);
2828

29-
* If the bug you experienced affects more than one layer, providing a simple
30-
failing unit test may not be sufficient. In this case, please fork the
31-
`Symfony Standard Edition`_ and reproduce your issue on a new branch;
29+
* If the bug you experienced is not obvious or affects more than one layer,
30+
providing a simple failing unit test may not be sufficient. In this case,
31+
please :doc:`provide a reproducer </contributing/code/reproducer>`;
3232

3333
* Give as much detail as possible about your environment (OS, PHP version,
3434
Symfony version, enabled extensions, ...);

doctrine.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ Updating an Object
677677
Once you've fetched an object from Doctrine, updating it is easy. Suppose
678678
you have a route that maps a product id to an update action in a controller::
679679

680-
use AppBundle\Entity\Post;
680+
use AppBundle\Entity\Product;
681681
// ...
682682

683683
public function updateAction($productId)

doctrine/event_listeners_subscribers.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,58 @@ interface and have an event method for each event it subscribes to::
214214

215215
For a full reference, see chapter `The Event System`_ in the Doctrine documentation.
216216

217+
Lazy loading for Event Listeners
218+
--------------------------------
219+
220+
One subtle difference between listeners and subscribers is that Symfony can load
221+
entity listeners lazily. This means that your listener class will only be fetched
222+
from the service container (and thus be instantiated) once the event it is linked
223+
to actually fires.
224+
225+
Lazy loading might give you a slight performance improvement when your listener
226+
runs for events that rarely fire. Also, it can help you when you run into
227+
*circular dependency issues* that may occur when your listener service in turn
228+
depends on the DBAL connection.
229+
230+
To mark a listener service as lazily loaded, just add the ``lazy`` attribute
231+
to the tag like so:
232+
233+
.. configuration-block::
234+
235+
.. code-block:: yaml
236+
237+
services:
238+
my.listener:
239+
class: AppBundle\EventListener\SearchIndexer
240+
tags:
241+
- { name: doctrine.event_listener, event: postPersist, lazy: true }
242+
243+
.. code-block:: xml
244+
245+
<?xml version="1.0" ?>
246+
<container xmlns="http://symfony.com/schema/dic/services"
247+
xmlns:doctrine="http://symfony.com/schema/dic/doctrine">
248+
249+
<services>
250+
<service id="my.listener" class="AppBundle\EventListener\SearchIndexer">
251+
<tag name="doctrine.event_listener" event="postPersist" lazy="true" />
252+
</service>
253+
</services>
254+
</container>
255+
256+
.. code-block:: php
257+
258+
use AppBundle\EventListener\SearchIndexer;
259+
260+
$container
261+
->register('my.listener', SearchIndexer::class)
262+
->addTag('doctrine.event_listener', array('event' => 'postPersist', 'lazy' => 'true'))
263+
;
264+
265+
.. note::
266+
267+
  Marking an event listener as ``lazy`` has nothing to do with lazy service
268+
definitions which are described :doc:`in their own section </service_container/lazy_services>`
269+
217270
.. _`The Event System`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html
218271
.. _`the Doctrine Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#entity-listeners

reference/configuration/twig.rst

Lines changed: 103 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ TwigBundle Configuration ("twig")
5555
paths:
5656
'%kernel.root_dir%/../vendor/acme/foo-bar/templates': foo_bar
5757
58+
# The following were added in Symfony 2.7.
59+
date:
60+
format: d.m.Y, H:i:s
61+
interval_format: '%%d days'
62+
timezone: Asia/Tokyo
63+
number_format:
64+
decimals: 2
65+
decimal_point: ','
66+
thousands_separator: '.'
67+
5868
.. code-block:: xml
5969
6070
<!-- app/config/config.xml -->
@@ -81,6 +91,9 @@ TwigBundle Configuration ("twig")
8191
8292
<twig:global key="foo" id="bar" type="service" />
8393
<twig:global key="pi">3.14</twig:global>
94+
95+
<twig:date format="d.m.Y, H:i:s" interval-format="%d days" timezone="Asia/Tokyo" />
96+
<twig:number-format decimals="2" decimal-point="," thousands-separator="." />
8497
8598
<twig:exception-controller>AcmeFooBundle:Exception:showException</twig:exception-controller>
8699
<twig:path namespace="foo_bar">%kernel.root_dir%/../vendor/acme/foo-bar/templates</twig:path>
@@ -94,23 +107,33 @@ TwigBundle Configuration ("twig")
94107
'form_themes' => array(
95108
'form_div_layout.html.twig', // Default
96109
'form.html.twig',
97-
),
98-
'globals' => array(
99-
'foo' => '@bar',
100-
'pi' => 3.14,
101-
),
102-
'auto_reload' => '%kernel.debug%',
103-
'autoescape' => 'name',
104-
'base_template_class' => 'Twig_Template',
105-
'cache' => '%kernel.cache_dir%/twig',
106-
'charset' => '%kernel.charset%',
107-
'debug' => '%kernel.debug%',
108-
'strict_variables' => false,
109-
'exception_controller' => 'AcmeFooBundle:Exception:showException',
110-
'optimizations' => true,
111-
'paths' => array(
112-
'%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar',
113-
),
110+
),
111+
'globals' => array(
112+
'foo' => '@bar',
113+
'pi' => 3.14,
114+
),
115+
'auto_reload' => '%kernel.debug%',
116+
'autoescape' => 'name',
117+
'base_template_class' => 'Twig_Template',
118+
'cache' => '%kernel.cache_dir%/twig',
119+
'charset' => '%kernel.charset%',
120+
'debug' => '%kernel.debug%',
121+
'strict_variables' => false,
122+
'exception_controller' => 'AcmeFooBundle:Exception:showException',
123+
'optimizations' => true,
124+
'paths' => array(
125+
'%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar',
126+
),
127+
'date' => array(
128+
'format' => 'd.m.Y, H:i:s',
129+
'interval_format' => '%%d days',
130+
'timezone' => 'Asia/Tokyo',
131+
),
132+
'number_format' => array(
133+
'decimals' => 2,
134+
'decimal_point' => ',',
135+
'thousands_separator' => '.',
136+
),
114137
));
115138
116139
.. caution::
@@ -210,6 +233,37 @@ charset
210233
The charset used by the template files. In the Symfony Standard edition this
211234
defaults to the ``UTF-8`` charset.
212235

236+
date
237+
~~~~
238+
239+
These options define the default values used by the ``date`` filter to format
240+
date and time values. They are useful to avoid passing the same arguments on
241+
every ``date`` filter call.
242+
243+
format
244+
......
245+
246+
**type**: ``string`` **default**: ``F j, Y H:i``
247+
248+
The format used by the ``date`` filter to display values when no specific format
249+
is passed as argument.
250+
251+
internal_format
252+
...............
253+
254+
**type**: ``string`` **default**: ``%d days``
255+
256+
The format used by the ``date`` filter to display ``DateInterval`` instances
257+
when no specific format is passed as argument.
258+
259+
timezone
260+
........
261+
262+
**type**: ``string`` **default**: (the value returned by ``date_default_timezone_get()``)
263+
264+
The timezone used when formatting date values with the ``date`` filter and no
265+
specific timezone is passed as argument.
266+
213267
debug
214268
~~~~~
215269

@@ -234,6 +288,38 @@ option is advanced. If you need to customize an error page you should use
234288
the previous link. If you need to perform some behavior on an exception,
235289
you should add a listener to the ``kernel.exception`` event (see :ref:`dic-tags-kernel-event-listener`).
236290

291+
number_format
292+
~~~~~~~~~~~~~
293+
294+
These options define the default values used by the ``number_format`` filter to
295+
format numeric values. They are useful to avoid passing the same arguments on
296+
every ``number_format`` filter call.
297+
298+
decimals
299+
........
300+
301+
**type**: ``integer`` **default**: ``0``
302+
303+
The number of decimals used to format numeric values when no specific number is
304+
passed as argument to the ``number_format`` filter.
305+
306+
decimal_point
307+
.............
308+
309+
**type**: ``string`` **default**: ``.``
310+
311+
The character used to separate the decimals from the integer part of numeric
312+
values when no specific character is passed as argument to the ``number_format``
313+
filter.
314+
315+
thousands_separator
316+
...................
317+
318+
**type**: ``string`` **default**: ``,``
319+
320+
The character used to separate every group of thousands in numeric values when
321+
no specific character is passed as argument to the ``number_format`` filter.
322+
237323
optimizations
238324
~~~~~~~~~~~~~
239325

reference/configuration/web_profiler.rst

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,71 @@
44
WebProfilerBundle Configuration ("web_profiler")
55
================================================
66

7+
The WebProfilerBundle provides detailed technical information about each request
8+
execution and displays it in both the web debug toolbar and the profiler.
9+
10+
.. caution::
11+
12+
The web debug toolbar is not available for responses of type ``StreamedResponse``.
13+
14+
Configuration
15+
-------------
16+
17+
* `toolbar`_
18+
* `position`_
19+
* `intercept_redirects`_
20+
* `excluded_ajax_paths`_
21+
* `verbose`_
22+
23+
toolbar
24+
~~~~~~~
25+
26+
**type**: ``boolean`` **default**: ``true``
27+
28+
It enables and disables the toolbar entirely. Usually you set this to ``true``
29+
in the ``dev`` and ``test`` environments and to ``false`` in the ``prod``
30+
environment.
31+
32+
position
33+
~~~~~~~~
34+
35+
**type**: ``string`` **default**: ``bottom``
36+
37+
It defines the location of the browser window where the toolbar is displayed.
38+
the only allowed values are ``bottom`` and ``top``.
39+
40+
intercept_redirects
41+
~~~~~~~~~~~~~~~~~~~
42+
43+
**type**: ``boolean`` **default**: ``false``
44+
45+
If a redirect occurs during an HTTP response, the browser follows it automatically
46+
and you won't see the toolbar or the profiler of the original URL, only the
47+
redirected URL.
48+
49+
When setting this option to ``true``, the browser *stops* before making any
50+
redirection and shows you the URL which is going to redirect to, its toolbar,
51+
and its profiler. Once you've inspected the toolbar/profiler data, you can click
52+
on the given link to perform the redirect.
53+
54+
excluded_ajax_paths
55+
~~~~~~~~~~~~~~~~~~~
56+
57+
**type**: ``string`` **default**: ``'^/(app(_[\\w]+)?\\.php/)?_wdt'``
58+
59+
When the toolbar logs Ajax requests, it matches their URLs against this regular
60+
expression. If the URL matches, the request is not displayed in the toolbar. This
61+
is useful when the application makes lots of Ajax requests or they are heavy and
62+
you want to exclude some of them.
63+
64+
verbose
65+
~~~~~~~
66+
67+
**type**: ``boolean`` **default**: ``true``
68+
69+
This option is **deprecated** and has no effect on the toolbar or the profiler,
70+
so you can safely remove it from your configuration.
71+
772
Full Default Configuration
873
--------------------------
974

@@ -13,23 +78,14 @@ Full Default Configuration
1378
1479
# app/config/config.yml
1580
web_profiler:
16-
17-
# DEPRECATED, it is not useful anymore and can be removed
18-
# safely from your configuration
19-
verbose: true
20-
21-
# display the web debug toolbar at the bottom of pages with
22-
# a summary of profiler info
2381
toolbar: false
2482
position: bottom
25-
26-
# gives you the opportunity to look at the collected data
27-
# before following the redirect
28-
intercept_redirects: false
29-
30-
# Exclude AJAX requests in the web debug toolbar for specified paths
83+
intercept_redirects: false
3184
excluded_ajax_paths: ^/bundles|^/_wdt
3285
86+
# DEPRECATED, it can be removed safely from your configuration
87+
verbose: true
88+
3389
.. code-block:: xml
3490
3591
<!-- app/config/config.xml -->

reference/forms/types/language.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ in the `International Components for Unicode`_ (e.g. ``fr`` or ``zh_Hant``).
1313

1414
.. note::
1515

16-
The locale of your user is guessed using :phpmethod:`Locale::getDefault`
16+
The locale of your user is guessed using :phpmethod:`Locale::getDefault`,
17+
which requires the ``intl`` PHP extension to be installed and enabled.
1718

1819
Unlike the ``ChoiceType``, you don't need to specify a ``choices`` option as the
1920
field type automatically uses a large list of languages. You *can* specify the option

reference/forms/types/repeated.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ the label (see `first_options`_).
172172
type
173173
~~~~
174174

175-
**type**: ``string`` **default**: ``text``
175+
**type**: ``string`` **default**: ``Symfony\Component\Form\Extension\Core\Type\TextType``
176176

177177
The two underlying fields will be of this field type. For example, passing
178178
``PasswordType::class`` will render two password fields.

0 commit comments

Comments
 (0)
0