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

Skip to content

Commit 2ac669f

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: [File Uploads] Check if the entity contains the files [HttpFoundation][Fix] Component version Explain how to get all flash messages Documented the security options related to redirections Reworded a note about custom constraints Minor fix in event (file uploading) Update configuration.rst Fix faulty conflict resolution Fixed a syntax issue Minor change Fix .rst formatting Twig Extension does no longer need getName() method Document that you can't pass empty strings to console options
2 parents 5e2dc29 + eff11ef commit 2ac669f

File tree

9 files changed

+84
-30
lines changed

9 files changed

+84
-30
lines changed

bundles/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ configuration of a specific bundle. The namespace is returned from the
325325
:method:`Extension::getNamespace() <Symfony\\Component\\DependencyInjection\\Extension\\Extension::getNamespace>`
326326
method. By convention, the namespace is a URL (it doesn't have to be a valid
327327
URL nor does it need to exists). By default, the namespace for a bundle is
328-
``http://example.org/dic/schema/DI_ALIAS``, where ``DI_ALIAS`` is the DI alias of
328+
``http://example.org/schema/dic/DI_ALIAS``, where ``DI_ALIAS`` is the DI alias of
329329
the extension. You might want to change this to a more professional URL::
330330

331331
// src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php

console/input.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,7 @@ You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or
206206
when the option was used without a value (``command --language``) or when
207207
it wasn't used at all (``command``). In both cases, the value retrieved for
208208
the option will be ``null``.
209+
210+
Similarly, due to a PHP limitation, there is no way to pass an empty string
211+
as the value of an option. In ``command --prefix`` and ``command --prefix=''``
212+
cases, the value of the ``prefix`` option will be ``null``.

contributing/code/core_team.rst

Lines changed: 1 addition & 1 deletion
8000
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Active Core Members
6666
* **Christophe Coevoet** (`stof`_) can merge into all components, bridges and
6767
bundles;
6868

69-
* **Kévin Dunglas** (`dunglas`_) can merge into the Serializer_
69+
* **Kévin Dunglas** (`dunglas`_) can merge into the PropertyInfo_ and the Serializer_
7070
component;
7171

7272
* **Abdellatif AitBoudad** (`aitboudad`_) can merge into the Translation_

controller.rst

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,21 +418,43 @@ read any flash messages from the session:
418418
.. code-block:: html+twig
419419

420420
{# app/Resources/views/base.html.twig #}
421-
{% for flash_message in app.session.flashBag.get('notice') %}
421+
422+
{# you can read and display just one flash message type... #}
423+
{% for flash_message in app.session.flash('notice') %}
422424
<div class="flash-notice">
423425
{{ flash_message }}
424426
</div>
425427
{% endfor %}
426428

429+
{# ...or you can read and display every flash message available #}
430+
{% for type, flash_messages in app.session.flashes %}
431+
{% for flash_message in flash_messages %}
432+
<div class="flash-{{ type }}">
433+
{{ flash_message }}
434+
</div>
435+
{% endif %}
436+
{% endfor %}
437+
427438
.. code-block:: html+php
428439

429440
<!-- app/Resources/views/base.html.php -->
441+
442+
// you can read and display just one flash message type...
430443
<?php foreach ($view['session']->getFlash('notice') as $message): ?>
431444
<div class="flash-notice">
432-
<?php echo "<div class='flash-error'>$message</div>" ?>
445+
<?php echo $message ?>
433446
</div>
434447
<?php endforeach ?>
435448

449+
// ...or you can read and display every flash message available
450+
<?php foreach ($view['session']->getFlashes() as $type => $flash_messages): ?>
451+
<?php foreach ($flash_messages as $flash_message): ?>
452+
<div class="flash-<?php echo $type ?>">
453+
<?php echo $message ?>
454+
</div>
455+
<?php endforeach ?>
456+
<?php endforeach ?>
457+
436458
.. note::
437459

438460
It's common to use ``notice``, ``warning`` and ``error`` as the keys of the

controller/upload_file.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ logic to a separate service::
243243

244244
return $fileName;
245245
}
246+
247+
public function getTargetDir()
248+
{
249+
return $this->targetDir;
250+
}
246251
}
247252

248253
Then, define a service for this class:
@@ -443,9 +448,13 @@ controller.
443448
{
444449
$entity = $args->getEntity();
445450

446-
$fileName = $entity->getBrochure();
451+
if (!$entity instanceof Product) {
452+
return;
453+
}
447454

448-
$entity->setBrochure(new File($this->targetPath.'/'.$fileName));
455+
if ($fileName = $entity->getBrochure()) {
456+
$entity->setBrochure(new File($this->uploader->getTargetDir().'/'.$fileName));
457+
}
449458
}
450459
}
451460

create_framework/http_foundation.rst

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,7 @@ To use this component, add it as a dependency of the project:
119119
Running this command will also automatically download the Symfony
120120
HttpFoundation component and install it under the ``vendor/`` directory.
121121
A ``composer.json`` and a ``composer.lock`` file will be generated as well,
122-
containing the new requirement:
123-
124-
.. code-block:: json
125-
126-
{
127-
"require": {
128-
"symfony/http-foundation": "^3.0"
129-
}
130-
}
131-
132-
The code block shows the content of the ``composer.json`` file (the actual
133-
version may vary).
122+
containing the new requirement.
134123

135124
.. sidebar:: Class Autoloading
136125

reference/configuration/security.rst

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,37 @@ request to the ``check_path`` URL.
384384
Redirecting after Login
385385
~~~~~~~~~~~~~~~~~~~~~~~
386386

387-
* ``always_use_default_target_path`` (type: ``boolean``, default: ``false``)
388-
* ``default_target_path`` (type: ``string``, default: ``/``)
389-
* ``target_path_parameter`` (type: ``string``, default: ``_target_path``)
390-
* ``use_referer`` (type: ``boolean``, default: ``false``)
387+
always_use_default_target_path
388+
..............................
389+
390+
**type**: ``boolean`` **default**: ``false``
391+
392+
If ``true``, users are always redirected to the default target path regardless
393+
of the previous URL that was stored in the session.
394+
395+
default_target_path
396+
....................
397+
398+
**type**: ``string`` **default**: ``/``
399+
400+
The page users are redirected to when there is no previous page stored in the
401+
session (for example, when the users browse the login page directly).
402+
403+
target_path_parameter
404+
.....................
405+
406+
**type**: ``string`` **default**: ``_target_path``
407+
408+
When using a login form, if you include an HTML element to set the target path,
409+
this option lets you change the name of the HTML element itself.
410+
411+
use_referer
412+
...........
413+
414+
**type**: ``boolean`` **default**: ``false``
415+
416+
If ``true``, the user is redirected to the value stored in the ``HTTP_REFERER``
417+
header when no previous URL was stored in the session.
391418

392419
.. _reference-security-pbkdf2:
393420

templating/twig_extension.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ As an example you'll create a price filter to format a given number into price::
4949

5050
return $price;
5151
}
52-
53-
public function getName()
54-
{
55-
return 'app_extension';
56-
}
5752
}
5853

54+
.. note::
55+
56+
  Prior to Twig 1.26, your extension had to define an additional ``getName()``
57+
method that returned a string with the extension's internal name (e.g.
58+
``app.my_extension``). When your extension needs to be compatible with Twig
59+
versions before 1.26, include this method which is omitted in the example
60+
above.
61+
5962
.. tip::
6063

6164
Along with custom filters, you can also add custom `functions`_ and register

validation/custom_constraint.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ load this service from the container.
193193

194194
.. note::
195195

196-
In earlier versions of Symfony, the tag required an ``alias`` key (usually set
197-
to the class name). This is still allowed your constraint's ``validateBy()``
198-
method can return this alias (instead of a class name).
196+
In earlier versions of Symfony, the tag required an ``alias`` key (usually
197+
set to the class name). This ``alias`` is now optional, but if you define
198+
it, your constraint's ``validatedBy()`` method must return the same value.
199199

200200
Class Constraint Validator
201201
~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)
0