8000 Merge branch '4.0' · symfony/symfony-docs@8e21247 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e21247

Browse files
committed
Merge branch '4.0'
* 4.0: Fixed the priority of the sticky locale example Fixed the types of some options in Collection constraint Fixed the default value of Choice strict option Update finder.rst Handler formatter example was using wrong defined service Updated the behavior of the checkDNS option Update doctrine.rst Add example for Finder::exclude Update form_csrf_caching.rst do never fetch private services from the container Fixed minor issues Separate dev dependencies from application dependencies Add lock configuration in framework bundle
2 parents 6c3aba3 + a2ba00b commit 8e21247

File tree

12 files changed

+63
-37
lines changed

12 files changed

+63
-37
lines changed

components/finder.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Each pattern has to resolve to at least one directory path.
105105
Exclude directories from matching with the
106106
:method:`Symfony\\Component\\Finder\\Finder::exclude` method::
107107

108+
// directories passed as argument must be relative to the ones defined with the in() method
108109
$finder->in(__DIR__)->exclude('ruby');
109110

110111
It's also possible to ignore directories that you don't have permission to read::

components/var_dumper/advanced.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -360,23 +360,23 @@ thus to dumpers. To help you do this (see the source code for how it works),
360360
the component comes with a set of wrappers for common additional semantics. You
361361
can use:
362362

363-
* :class:`Symfony\\Component\\VarDumper\\Caster\\ConstStub` to wrap a value that is
364-
best represented by a PHP constant;
365-
* :class:`Symfony\\Component\\VarDumper\\Caster\\ClassStub` to wrap a PHP identifier
366-
(*i.e.* a class name, a method name, an interface, *etc.*);
367-
* :class:`Symfony\\Component\\VarDumper\\Caster\\CutStub` to replace big noisy
368-
objects/strings/*etc.* by ellipses;
369-
* :class:`Symfony\\Component\\VarDumper\\Caster\\CutArrayStub` to keep only some
370-
useful keys of an array;
371-
* :class:`Symfony\\Component\\VarDumper\\Caster\\EnumStub` to wrap a set of virtual
372-
values (*i.e.* values that do not exist as properties in the original PHP data
373-
structure, but are worth listing alongside with real ones);
374-
* :class:`Symfony\\Component\\VarDumper\\Caster\\LinkStub` to wrap strings that can
375-
be turned into links by dumpers;
376-
* :class:`Symfony\\Component\\VarDumper\\Caster\\TraceStub` and their
377-
* :class:`Symfony\\Component\\VarDumper\\Caster\\FrameStub` and
378-
* :class:`Symfony\\Component\\VarDumper\\Caster\\ArgsStub` relatives to wrap PHP
379-
traces (used by :class:`Symfony\\Component\\VarDumper\\Caster\\ExceptionCaster`).
363+
* :class:`Symfony\\Component\\VarDumper\\Caster\\ConstStub` to wrap a value that is
364+
best represented by a PHP constant;
365+
* :class:`Symfony\\Component\\VarDumper\\Caster\\ClassStub` to wrap a PHP identifier
366+
(*i.e.* a class name, a method name, an interface, *etc.*);
367+
* :class:`Symfony\\Component\\VarDumper\\Caster\\CutStub` to replace big noisy
368+
objects/strings/*etc.* by ellipses;
369+
* :class:`Symfony\\Component\\VarDumper\\Caster\\CutArrayStub` to keep only some
370+
useful keys of an array;
371+
* :class:`Symfony\\Component\\VarDumper\\Caster\\EnumStub` to wrap a set of virtual
372+
values (*i.e.* values that do not exist as properties in the original PHP data
373+
structure, but are worth listing alongside with real ones);
374+
* :class:`Symfony\\Component\\VarDumper\\Caster\\LinkStub` to wrap strings that can
375+
be turned into links by dumpers;
376+
* :class:`Symfony\\Component\\VarDumper\\Caster\\TraceStub` and their
377+
* :class:`Symfony\\Component\\VarDumper\\Caster\\FrameStub` and
378+
* :class:`Symfony\\Component\\VarDumper\\Caster\\ArgsStub` relatives to wrap PHP
379+
traces (used by :class:`Symfony\\Component\\VarDumper\\Caster\\ExceptionCaster`).
380380

381381
For example, if you know that your ``Product`` objects have a ``brochure`` property
382382
that holds a file name or a URL, you can wrap them in a ``LinkStub`` to tell

frontend/encore/reactjs.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Using React? Make sure you have React installed, along with the `babel-preset-re
55

66
.. code-block:: terminal
77
8-
$ yarn add --dev react react-dom prop-types babel-preset-react
8+
$ yarn add --dev babel-preset-react
9+
$ yarn add react react-dom prop-types
910
1011
Enable react in your ``webpack.config.js``:
1112

http_cache/form_csrf_caching.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ Another option would be to load the form via an uncached AJAX request, but
3636
cache the rest of the HTML response.
3737

3838
Or you can even load just the CSRF token with an AJAX request and replace the
39-
form field value with it.
39+
form field value with it. Take a look at :doc:`hinclude.js </templating/hinclude>`
40+
for a nice solution.
4041

4142
.. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery
4243
.. _`Security CSRF Component`: https://github.com/symfony/security-csrf

logging/processors.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Finally, set the formatter to be used on whatever handler you want:
138138
type="stream"
139139
path="%kernel.logs_dir%/%kernel.environment%.log"
140140
level="debug"
141-
formatter="app.logger.session_request_processor"
141+
formatter="monolog.formatter.session_request"
142142
/>
143143
</monolog:config>
144144
</container>
@@ -152,7 +152,7 @@ Finally, set the formatter to be used on whatever handler you want:
152152
'type' => 'stream',
153153
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
154154
'level' => 'debug',
155-
'formatter' => 'app.logger.session_request_processor',
155+
'formatter' => 'monolog.formatter.session_request',
156156
),
157157
),
158158
));

reference/configuration/doctrine.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ Full Default Configuration
3131
port: ~
3232
user: root
3333
password: ~
34+
# charset of the database
3435
charset: ~
36+
# charset and collation of the tables. Not inherited from database
37+
default_table_options:
38+
charset: ~
39+
collate: ~
3540
path: ~
3641
memory: ~
3742

reference/configuration/framework.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Configuration
131131
* `provider`_
132132
* `clearer`_
133133
* `prefix_seed`_
134+
* :ref:`lock <reference-lock>`
134135

135136
secret
136137
~~~~~~
@@ -1877,6 +1878,16 @@ It's also useful when using `blue/green deployment`_ strategies and more
18771878
generally, when you need to abstract out the actual deployment directory (for
18781879
example, when warming caches offline).
18791880

1881+
.. _reference-lock:
1882+
1883+
lock
1884+
~~~~
1885+
1886+
**type**: ``string``
1887+
1888+
The default lock adapter. If not defined, the value is set to ``semaphore`` when
1889+
available, or to ``flock`` otherwise. Store's DSN are also allowed.
1890+
18801891
Full Default Configuration
18811892
--------------------------
18821893

@@ -2033,6 +2044,14 @@ Full Default Configuration
20332044
provider: ~
20342045
clearer: ~
20352046
2047+
# lock configuration
2048+
lock:
2049+
invoice: 'redis://localhost'
2050+
report: semaphore
2051+
# lock: ~
2052+
# lock: 'flock'
2053+
# lock: ['semaphore', 'redis://localhost']
2054+
20362055
.. _`HTTP Host header attacks`: http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
20372056
.. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning
20382057
.. _`Doctrine Cache`: http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/caching.html

reference/constraints/Choice.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ too many options per the `max`_ option.
365365
strict
366366
~~~~~~
367367

368-
**type**: ``boolean`` **default**: ``false``
368+
**type**: ``boolean`` **default**: ``true``
369369

370370
The validator will also check the type of the input value. Specifically,
371371
this value is passed to as the third argument to the PHP :phpfunction:`in_array`
1CF5

reference/constraints/Collection.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ error will be returned. If set to ``true``, extra fields are ok.
310310
extraFieldsMessage
311311
~~~~~~~~~~~~~~~~~~
312312

313-
**type**: ``boolean`` **default**: ``This field was not expected.``
313+
**type**: ``string`` **default**: ``This field was not expected.``
314314

315315
The message shown if `allowExtraFields`_ is false and an extra field is
316316
detected.
@@ -328,7 +328,7 @@ option are not present in the underlying collection.
328328
missingFieldsMessage
329329
~~~~~~~~~~~~~~~~~~~~
330330

331-
**type**: ``boolean`` **default**: ``This field is missing.``
331+
**type**: ``string`` **default**: ``This field is missing.``
332332

333333
The message shown if `allowMissingFields`_ is false and one or more fields
334334
are missing from the underlying collection.

reference/constraints/Url.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ checkDNS
239239

240240
By default, this constraint just validates the syntax of the given URL. If you
241241
also need to check whether the associated host exists, set the ``checkDNS``
242-
option to ``true``:
242+
option to the value of any of the ``CHECK_DNS_TYPE_*`` constants in the
243+
:class:`Symfony\\Component\\Validator\\Constraints\\Url` class:
243244

244245
.. configuration-block::
245246

@@ -254,7 +255,7 @@ option to ``true``:
254255
{
255256
/**
256257
* @Assert\Url(
257-
* checkDNS = true
258+
* checkDNS = "ANY"
258259
* )
259260
*/
260261
protected $bioUrl;
@@ -266,7 +267,7 @@ option to ``true``:
266267
App\Entity\Author:
267268
properties:
268269
bioUrl:
269-
- Url: { checkDNS: true }
270+
- Url: { checkDNS: 'ANY' }
270271
271272
.. code-block:: xml
272273
@@ -279,7 +280,7 @@ option to ``true``:
279280
<class name="App\Entity\Author">
280281
<property name="bioUrl">
281282
<constraint name="Url">
282-
<option name="checkDNS">true</option>
283+
<option name="checkDNS">ANY</option>
283284
</constraint>
284285
</property>
285286
</class>
@@ -298,13 +299,13 @@ option to ``true``:
298299
public static function loadValidatorMetadata(ClassMetadata $metadata)
299300
{
300301
$metadata->addPropertyConstraint('bioUrl', new Assert\Url(array(
301-
'checkDNS' => true,
302+
'checkDNS' => Assert\Url::CHECK_DNS_TYPE_ANY,
302303
)));
303304
}
304305
}
305306
306307
This option uses the :phpfunction:`checkdnsrr` PHP function to check the validity
307-
of the ``ANY`` DNS record corresponding to the host associated with the given URL.
308+
of the DNS record corresponding to the host associated with the given URL.
308309

309310
dnsMessage
310311
~~~~~~~~~~

service_container/alias_private.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,15 @@ gives you better errors: if you try to reference a non-existent service, you wil
6868
get a clear error when you refresh *any* page, even if the problematic code would
6969
not have run on that page.
7070

71-
Now that the service is private, you *should not* fetch the service directly
71+
Now that the service is private, you *must not* fetch the service directly
7272
from the container::
7373

7474
use App\Service\Foo;
7575

7676
$container->get(Foo::class);
7777

78-
This *may or may not work*, depending on how the container has optimized the
79-
service instantiation and, even in the cases where it works, this possibility is
80-
deprecated. Simply said: A service should be marked as private if you do not want
81-
to access it directly from your code.
78+
Simply said: A service can be marked as private if you do not want to access
79+
it directly from your code.
8280

8381
However, if a service has been marked as private, you can still alias it
8482
(see below) to access this service (via the alias).

session/locale_sticky_session.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ correct locale however you want::
5252
public static function getSubscribedEvents()
5353
{
5454
return array(
55-
// must be registered after the default Locale listener
56-
KernelEvents::REQUEST => array(array('onKernelRequest', 15)),
55+
// must be registered before (i.e. with a higher priority than) the default Locale listener
56+
KernelEvents::REQUEST => array(array('onKernelRequest', 20)),
5757
);
5858
}
5959
}

0 commit comments

Comments
 (0)
0