Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c7af8cf

Browse filesBrowse files
committed
Merge branch '3.2'
* 3.2: (24 commits) Minor rewords Update session_configuration.rst [#7522] minor wording improvement [#7513] fix line length Update 'ide' example in framework.rst [#7219] move versionadded in front of description Improved the image for Doctrine + Web Debug Toolbar [Serializer] Docs for the PropertyInfo integration Finished this PR section chronology in comment Removed the example about Redis Update cache.rst Update bundles/configuration.rst Fix typos Removed tip that was meant for the 2.x versions fix usage of the session flag bag API Add caution related to deprecate mail transport Use https URLs when possible [Requirements] Clarify what are JSON and ctype Proposed a minor reword ...
2 parents 3467fc1 + 9435c92 commit c7af8cf
Copy full SHA for c7af8cf

File tree

Expand file treeCollapse file tree

17 files changed

+149
-31
lines changed
Filter options
Expand file treeCollapse file tree

17 files changed

+149
-31
lines changed
49.9 KB
Loading
-43.1 KB
Binary file not shown.

‎bundles/configuration.rst

Copy file name to clipboardExpand all lines: bundles/configuration.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ bundle configuration would look like:
8383
<?xml version="1.0" ?>
8484
8585
<container xmlns="http://symfony.com/schema/dic/services"
86-
xmlns:acme-social="http://example.org/dic/schema/acme_social"
86+
xmlns:acme-social="http://example.org/schema/dic/acme_social"
8787
xsi:schemaLocation="http://symfony.com/schema/dic/services
8888
http://symfony.com/schema/dic/services/services-1.0.xsd">
8989

‎components/cache.rst

Copy file name to clipboardExpand all lines: components/cache.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ concepts:
143143
**Adapter**
144144
It implements the actual caching mechanism to store the information in the
145145
filesystem, in a database, etc. The component provides several ready to use
146-
adapters for common caching backends (Redis, APCu, etc.)
146+
adapters for common caching backends (Redis, APCu, Doctrine, PDO, etc.)
147147

148148
Basic Usage (PSR-6)
149149
-------------------

‎components/cache/cache_invalidation.rst

Copy file name to clipboardExpand all lines: components/cache/cache_invalidation.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Cache Invalidation
77

88
Cache invalidation is the process of removing all cached items related to a
99
change in the state of your model. The most basic kind of invalidation is direct
10-
items deletion. But when the state of a primary resource has spread accross
10+
items deletion. But when the state of a primary resource has spread across
1111
several cached items, keeping them in sync can be difficult.
1212

1313
The Symfony Cache component provides two mechanisms to help solving this problem:

‎components/config/caching.rst

Copy file name to clipboardExpand all lines: components/config/caching.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ should be regenerated::
3838
$resources = array();
3939

4040
foreach ($yamlUserFiles as $yamlUserFile) {
41-
// see the previous article "Loading resources" to
42-
// see where $delegatingLoader comes from
41+
// see the article "Loading resources" to
42+
// know where $delegatingLoader comes from
4343
$delegatingLoader->load($yamlUserFile);
4444
$resources[] = new FileResource($yamlUserFile);
4545
}

‎components/http_foundation/session_configuration.rst

Copy file name to clipboardExpand all lines: components/http_foundation/session_configuration.rst
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ the ``php.ini`` directive ``session.gc_maxlifetime``. The meaning in this contex
139139
that any stored session that was saved more than ``gc_maxlifetime`` ago should be
140140
deleted. This allows one to expire records based on idle time.
141141

142+
However, some operating systems do their own session handling and set the
143+
``session.gc_probability`` variable to ``0`` to stop PHP doing garbage
144+
collection. That's why Symfony now overwrites this value to ``1``.
145+
146+
If you wish to use the original value set in your ``php.ini``, add the following
147+
configuration:
148+
149+
.. code-block:: yaml
150+
151+
# config.yml
152+
framework:
153+
session:
154+
gc_probability: null
155+
142156
You can configure these settings by passing ``gc_probability``, ``gc_divisor``
143157
and ``gc_maxlifetime`` in an array to the constructor of
144158
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage`

‎components/serializer.rst

Copy file name to clipboardExpand all lines: components/serializer.rst
+68Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,74 @@ you indicate that you're expecting an array instead of a single object.
821821
$data = ...; // The serialized data from the previous example
822822
$persons = $serializer->deserialize($data, 'Acme\Person[]', 'json');
823823
824+
Recursive Denormalization and Type Safety
825+
-----------------------------------------
826+
827+
The Serializer Component can use the :doc:`PropertyInfo Component </components/property_info>` to denormalize
828+
complex types (objects). The type of the class' property will be guessed using the provided
829+
extractor and used to recursively denormalize the inner data.
830+
831+
When using the Symfony Standard Edition, all normalizers are automatically configured to use the registered extractors.
832+
When using the component standalone, an implementation of :class:`Symfony\\Component\\PropertyInfo\\PropertyTypeExtractorInterface`,
833+
(usually an instance of :class:`Symfony\\Component\\PropertyInfo\\PropertyInfoExtractor`) must be passed as the 4th
834+
parameter of the ``ObjectNormalizer``::
835+
836+
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
837+
use Symfony\Component\Serializer\Serializer;
838+
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
839+
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
840+
841+
namespace Acme;
842+
843+
class ObjectOuter
844+
{
845+
private $inner;
846+
private $date;
847+
848+
public function getInner()
849+
{
850+
return $this->inner;
851+
}
852+
853+
public function setInner(ObjectInner $inner)
854+
{
855+
$this->inner = $inner;
856+
}
857+
858+
public function setDate(\DateTimeInterface $date)
859+
{
860+
$this->date = $date;
861+
}
862+
863+
public function getDate()
864+
{
865+
return $this->date;
866+
}
867+
}
868+
869+
class ObjectInner
870+
{
871+
public $foo;
872+
public $bar;
873+
}
874+
875+
$normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor()); //
876+
$serializer = new Serializer(array(new DateTimeNormalizer(), $normalizer));
877+
878+
$obj = $serializer->denormalize(
879+
array('inner' => array('foo' => 'foo', 'bar' => 'bar'), 'date' => '1988/01/21'),
880+
'Acme\ObjectOuter'
881+
);
882+
883+
dump($obj->getInner()->foo); // 'foo'
884+
dump($obj->getInner()->bar); // 'bar'
885+
dump($obj->getDate()->format('Y-m-d')); // '1988-01-21'
886+
887+
When a ``PropertyTypeExtractor`` is available, the normalizer will also check that the data to denormalize
888+
matches the type of the property (even for primitive types). For instance, if a ``string`` is provided, but
889+
the type of the property is ``int``, an :class:`Symfony\\Component\\Serializer\\Exception\\UnexpectedValueException`
890+
will be thrown.
891+
824892
Learn more
825893
----------
826894

‎controller.rst

Copy file name to clipboardExpand all lines: controller.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,14 @@ read any flash messages from the session:
436436
<!-- app/Resources/views/base.html.php -->
437437

438438
// you can read and display just one flash message type...
439-
<?php foreach ($view['session']->getFlash('notice') as $message): ?>
439+
<?php foreach ($view['session']->getFlashBag()->get('notice') as $message): ?>
440440
<div class="flash-notice">
441441
<?php echo $message ?>
442442
</div>
443443
<?php endforeach ?>
444444

445445
// ...or you can read and display every flash message available
446-
<?php foreach ($view['session']->getFlashes() as $type => $flash_messages): ?>
446+
<?php foreach ($view['session']->getFlashBag()->all() as $type => $flash_messages): ?>
447447
<?php foreach ($flash_messages as $flash_message): ?>
448448
<div class="flash-<?php echo $type ?>">
449449
<?php echo $message ?>

‎controller/service.rst

Copy file name to clipboardExpand all lines: controller/service.rst
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,6 @@ controller:
336336
337337
return new StreamedResponse($callback);
338338
339-
.. tip::
340-
341-
``getRequest()`` has been deprecated. Instead, have an argument to your
342-
controller action method called ``Request $request``. The order of the
343-
parameters is not important, but the typehint must be provided.
344-
345339
.. _`Controller class source code`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
346340
.. _`base Controller class`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
347341
.. _`FrameworkExtraBundle documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/routing.html#controller-as-service

‎doctrine.rst

Copy file name to clipboardExpand all lines: doctrine.rst
+8-10Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -707,19 +707,17 @@ to easily fetch objects based on multiple conditions::
707707

708708
.. tip::
709709

710-
When you render any page, you can see how many queries were made in the
711-
bottom right corner of the web debug toolbar.
710+
When rendering a page requires to make some database calls, the web debug
711+
toolbar at the bottom of the page displays the number of queries and the
712+
time it took to execute them:
712713

713-
.. image:: /_images/doctrine/web_debug_toolbar.png
714+
.. image:: /_images/doctrine/doctrine_web_debug_toolbar.png
714715
:align: center
715-
:scale: 50
716-
:width: 350
716+
:class: with-browser
717717

718-
If you click the icon, the profiler will open, showing you the exact
719-
queries that were made.
720-
721-
The icon will turn yellow if there were more than 50 queries on the
722-
page. This could indicate that something is not correct.
718+
If the number of database queries is too high, the icon will turn yellow to
719+
indicate that something may not be correct. Click on the icon to open the
720+
Symfony Profiler and see the exact queries that were executed.
723721

724722
Updating an Object
725723
~~~~~~~~~~~~~~~~~~

‎email.rst

Copy file name to clipboardExpand all lines: email.rst
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ The following configuration attributes are available:
8686
* ``delivery_addresses`` (an array of email addresses where to send ALL emails)
8787
* ``disable_delivery`` (set to true to disable delivery completely)
8888

89+
.. caution::
90+
91+
Starting from SwiftMailer 5.4.5, the ``mail`` transport is deprecated
92+
and will be removed in version 6. Consider using another transport like
93+
``smtp``, ``sendmail`` or ``gmail``.
94+
8995
Sending Emails
9096
--------------
9197

‎logging.rst

Copy file name to clipboardExpand all lines: logging.rst
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,15 @@ option of your handler to ``rotating_file``:
308308
),
309309
));
310310
311+
Using a Logger inside a Service
312+
-------------------------------
313+
314+
To use a logger in your own services, add the ``@logger`` service as an argument
315+
of those services. If you want to use a pre-configured logger which uses a
316+
specific channel (``app`` by default), use the ``monolog.logger`` tag with the
317+
``channel`` property as explained in the
318+
:ref:`Dependency Injection reference <dic_tags-monolog>`.
319+
311320
Adding extra Data to each Log (e.g. a unique request token)
312321
-----------------------------------------------------------
313322

‎reference/configuration/framework.rst

Copy file name to clipboardExpand all lines: reference/configuration/framework.rst
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,12 @@ ide
216216
Symfony turns file paths seen in variable dumps and exception messages into
217217
links that open those files right inside your browser. If you prefer to open
218218
those files in your favorite IDE or text editor, set this option to any of the
219-
following values: ``phpstorm`` (requires `PhpStormProtocol`_), ``sublime``,
220-
``textmate``, ``macvim`` and ``emacs``.
219+
following values: ``phpstorm``, ``sublime``, ``textmate``, ``macvim`` and ``emacs``.
220+
221+
.. note::
222+
223+
The ``phpstorm`` option is supported natively by PhpStorm on MacOS,
224+
Windows requires `PhpStormProtocol`_ and Linux requires `phpstorm-url-handler`_.
221225

222226
If you use another editor, the expected configuration value is a URL template
223227
that contains an ``%f`` placeholder where the file path is expected and ``%l``
@@ -230,7 +234,7 @@ doubling them to prevent Symfony from interpreting them as container parameters)
230234
231235
# app/config/config.yml
232236
framework:
233-
ide: 'phpstorm://open?file=%%f&line=%%l'
237+
ide: 'myide://open?url=file://%%f&line=%%l'
234238
235239
.. code-block:: xml
236240
@@ -242,14 +246,14 @@ doubling them to prevent Symfony from interpreting them as container parameters)
242246
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
243247
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
244248
245-
<framework:config ide="phpstorm://open?file=%%f&line=%%l" />
249+
<framework:config ide="myide://open?url=file://%%f&line=%%l" />
246250
</container>
247251
248252
.. code-block:: php
249253
250254
// app/config/config.php
251255
$container->loadFromExtension('framework', array(
252-
'ide' => 'phpstorm://open?file=%%f&line=%%l',
256+
'ide' => 'myide://open?url=file://%%f&line=%%l',
253257
));
254258
255259
Since every developer uses a different IDE, the recommended way to enable this
@@ -1670,4 +1674,5 @@ Full Default Configuration
16701674
.. _`Doctrine Cache`: http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/caching.html
16711675
.. _`egulias/email-validator`: https://github.com/egulias/EmailValidator
16721676
.. _`PhpStormProtocol`: https://github.com/aik099/PhpStormProtocol
1677+
.. _`phpstorm-url-handler`: https://github.com/sanduhrs/phpstorm-url-handler
16731678
.. _`blue/green deployment`: http://martinfowler.com/bliki/BlueGreenDeployment.html

‎reference/forms/types/choice.rst

Copy file name to clipboardExpand all lines: reference/forms/types/choice.rst
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,27 @@ The ``choice_loader`` can be used to only partially load the choices in cases wh
184184
a fully-loaded list is not necessary. This is only needed in advanced cases and
185185
would replace the ``choices`` option.
186186

187+
.. versionadded:: 3.2
188+
The :class:`Symfony\\Component\\Form\\ChoiceList\\Loader\\CallbackChoiceLoader`
189+
was introduced in Symfony 3.2.
190+
191+
You can use an instance of :class:`Symfony\\Component\\Form\\ChoiceList\\Loader\\CallbackChoiceLoader`
192+
if you want to take advantage of lazy loading::
193+
194+
use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
195+
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
196+
// ...
197+
198+
$builder->add('constants', ChoiceType::class, array(
199+
'choice_loader' => new CallbackChoiceLoader(function() {
200+
return StaticClass::getConstants();
201+
},
202+
));
203+
204+
This will cause the call of ``StaticClass::getConstants()`` to not happen if the
205+
request is redirected and if there is no pre set or submitted data. Otherwise
206+
the choice options would need to be resolved thus triggering the callback.
207+
187208
.. include:: /reference/forms/types/options/choice_name.rst.inc
188209

189210
.. include:: /reference/forms/types/options/choice_translation_domain.rst.inc

‎reference/requirements.rst

Copy file name to clipboardExpand all lines: reference/requirements.rst
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Required
2222
--------
2323

2424
* PHP needs to be a minimum version of PHP 5.5.9
25-
* JSON needs to be enabled
26-
* ctype needs to be enabled
25+
* `JSON extension`_ needs to be enabled
26+
* `ctype extension`_ needs to be enabled
2727
* Your ``php.ini`` needs to have the ``date.timezone`` setting
2828

2929
Optional
@@ -50,3 +50,6 @@ Doctrine
5050
If you want to use Doctrine, you will need to have PDO installed. Additionally,
5151
you need to have the PDO driver installed for the database server you want
5252
to use.
53+
54+
.. _`JSON extension`: https://php.net/manual/book.json.php
55+
.. _`ctype extension`: https://php.net/manual/book.ctype.php

‎workflow.rst

Copy file name to clipboardExpand all lines: workflow.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ a user submits a series of different forms to complete a task. Such processes ar
77
best kept away from your models and should be defined in configuration.
88

99
A **definition** of a workflow consist of places and actions to get from one
10-
place to another. The actions are called **transistions**. A workflow does also
10+
place to another. The actions are called **transitions**. A workflow does also
1111
need to know each object's position in the workflow. That **marking store** writes
1212
to a property of the object to remember the current place.
1313

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.