10000 Merge branch '3.1' · symfony/symfony-docs@06b4761 · GitHub
[go: up one dir, main page]

Skip to content

Commit 06b4761

Browse files
committed
Merge branch '3.1'
* 3.1: [#6961] add additional config formats [#7104] minor typo fix Fixed minor syntax issues and typos more precision on class name, and lazy service add warning about the limitation on using swiftmail with file spool and lazy loading Removed the proposed note and updated the title Added note on ODM id notation being different [#7099] remove trailing whitespaces Clarify Process::wait() callback behaviour Remove AssetsHelper from the templating component Minor text fix - wrong submit button label (Forms) [Doctrine] Slave/Master configuration options Fix broken link Fix typo Add missing parenthesis for methods and a few minor tweaks Update input.rst [Profiler] Fix rst typo [Doctrine] Exception note about functions with named managers
2 parents b87b882 + da25d3c commit 06b4761

File tree

11 files changed

+122
-154
lines changed

11 files changed

+122
-154
lines changed

components/process.rst

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,23 @@ are done doing other stuff::
133133

134134
// ... do other things
135135

136+
$process->wait();
137+
138+
// ... do things after the process has finished
139+
140+
.. note::
141+
142+
The :method:`Symfony\\Component\\Process\\Process::wait` method is blocking,
143+
which means that your code will halt at this line until the external
144+
process is completed.
145+
146+
:method:`Symfony\\Component\\Process\\Process::wait` takes one optional argument:
147+
a callback that is called repeatedly whilst the process is still running, passing
148+
in the output and its type::
149+
150+
$process = new Process('ls -lsa');
151+
$process->start();
152+
136153
$process->wait(function ($type, $buffer) {
137154
if (Process::ERR === $type) {
138155
echo 'ERR > '.$buffer;
@@ -141,12 +158,6 @@ are done doing other stuff::
141158
}
142159
});
143160

144-
.. note::
145-
146-
The :method:`Symfony\\Component\\Process\\Process::wait` method is blocking,
147-
which means that your code will halt at this line until the external
148-
process is completed.
149-
150161
Streaming to the Standard Input of a Process
151162
--------------------------------------------
152163

components/templating.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,17 @@ Helpers
139139

140140
The Templating component can be easily extended via helpers. Helpers are PHP objects that
141141
provide features useful in a template context. The component has
142-
2 built-in helpers:
142+
one built-in helper:
143143

144-
* :doc:`/components/templating/assetshelper`
145144
* :doc:`/components/templating/slotshelper`
146145

147146
Before you can use these helpers, you need to register them using
148147
:method:`Symfony\\Component\\Templating\\PhpEngine::set`::
149148

150-
use Symfony\Component\Templating\Helper\AssetsHelper;
149+
use Symfony\Component\Templating\Helper\SlotsHelper;
151150
// ...
152151

153-
$templating->set(new AssetsHelper());
152+
$templating->set(new SlotsHelper());
154153
155154
Custom Helpers
156155
~~~~~~~~~~~~~~

components/templating/assetshelper.rst

Lines changed: 0 additions & 131 deletions
This file was deleted.

deployment/platformsh.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ That's it! Your Symfony application will be bootstrapped and deployed. You'll
185185
soon be able to see it in your browser.
186186

187187
.. _`Platform.sh`: https://platform.sh
188-
.. _`Platform.sh documentation`: https://docs.platform.sh/toolstacks/symfony/symfony-getting-started
188+
.. _`Platform.sh documentation`: https://docs.platform.sh/frameworks/symfony.html
189189
.. _`Platform.sh project`: https://marketplace.commerceguys.com/platform/buy-now
190190
.. _`Platform.sh configuration files`: https://docs.platform.sh/reference/configuration-files
191191
.. _`GitHub`: https://github.com/platformsh/platformsh-examples

doctrine.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. index::
22
single: Doctrine
33

4-
Databases and Doctrine
5-
======================
4+
Databases and the Doctrine ORM
5+
==============================
66

77
One of the most common and challenging tasks for any application
88
involves persisting and reading information to and from a database. Although
@@ -582,10 +582,10 @@ Take a look at the previous example in more detail:
582582
responsible for the process of persisting objects to, and fetching objects
583583
from, the database.
584584

585-
* **line 17** The ``persist($product)`` call tells Doctrine to "manage" the
585+
* **line 18** The ``persist($product)`` call tells Doctrine to "manage" the
586586
``$product`` object. This does **not** cause a query to be made to the database.
587587

588-
* **line 18** When the ``flush()`` method is called, Doctrine looks through
588+
* **line 21** When the ``flush()`` method is called, Doctrine looks through
589589
all of the objects that it's managing to see if they need to be persisted
590590
to the database. In this example, the ``$product`` object's data doesn't
591591
exist in the database, so the entity manager executes an ``INSERT`` query,
@@ -675,7 +675,7 @@ Once you have a repository object, you can access all sorts of helpful methods::
675675
Of course, you can also issue complex queries, which you'll learn more
676676
about in the :ref:`doctrine-queries` section.
677677

678-
You can also take advantage of the useful ``findBy`` and ``findOneBy`` methods
678+
You can also take advantage of the useful ``findBy()`` and ``findOneBy()`` methods
679679
to easily fetch objects based on multiple conditions::
680680

681681
$repository = $this->getDoctrine()->getRepository('AppBundle:Product');
@@ -734,7 +734,7 @@ Updating an object involves just three steps:
734734

735735
#. fetching the object from Doctrine;
736736
#. modifying the object;
737-
#. calling ``flush()`` on the entity manager
737+
#. calling ``flush()`` on the entity manager.
738738

739739
Notice that calling ``$em->persist($product)`` isn't necessary. Recall that
740740
this method simply tells Doctrine to manage or "watch" the ``$product`` object.
@@ -825,7 +825,7 @@ DQL as you start to concatenate strings::
825825
$repository = $this->getDoctrine()
826826
->getRepository('AppBundle:Product');
827827

828-
// createQueryBuilder automatically selects FROM AppBundle:Product
828+
// createQueryBuilder() automatically selects FROM AppBundle:Product
829829
// and aliases it to "p"
830830
$query = $repository->createQueryBuilder('p')
831831
->where('p.price > :price')

doctrine/custom_dql_functions.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,74 @@ In Symfony, you can register your custom DQL functions as follows:
6969
),
7070
));
7171
72+
.. note::
73+
74+
In case the ``entity_managers`` were named explicitly, configuring the functions with the
75+
orm directly will trigger the exception `Unrecognized option "dql" under "doctrine.orm"`.
76+
The `dql` configuration block must be defined under the named entity manager.
77+
78+
.. configuration-block::
79+
80+
.. code-block:: yaml
81+
82+
# app/config/config.yml
83+
doctrine:
84+
orm:
85+
# ...
86+
entity_managers:
87+
example_manager:
88+
# Place your functions here
89+
dql:
90+
datetime_functions:
91+
test_datetime: AppBundle\DQL\DatetimeFunction
92+
93+
.. code-block:: xml
94+
95+
# app/config/config.xml
96+
<?xml version="1.0" encoding="UTF-8" ?>
97+
<container xmlns="http://symfony.com/schema/dic/services"
98+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99+
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
100+
xsi:schemaLocation="http://symfony.com/schema/dic/services
101+
http://symfony.com/schema/dic/services/services-1.0.xsd
102+
http://symfony.com/schema/dic/doctrine
103+
http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
104+
105+
<doctrine:config>
106+
<doctrine:orm>
107+
<!-- ... -->
108+
109+
<doctrine:entity-manager name="example_manager">
110+
<!-- place your functions here -->
111+
<doctrine:dql>
112+
<doctrine:datetime-function name="test_datetime">
113+
AppBundle\DQL\DatetimeFunction
114+
</doctrine:datetime-function>
115+
</doctrine:dql>
116+
</doctrine:entity-manager>
117+
</doctrine:orm>
118+
</doctrine:config>
119+
</container>
120+
121+
.. code-block:: php
122+
123+
// app/config/config.php
124+
$container->loadFromExtension('doctrine', array(
125+
'doctrine' => array(
126+
'orm' => array(
127+
// ...
128+
'entity_managers' => array(
129+
'example_manager' => array(
130+
// place your functions here
131+
'dql' => array(
132+
'datetime_functions' => array(
133+
'test_datetime' => 'AppBundle\DQL\DatetimeFunction',
134+
),
135+
),
136+
),
137+
),
138+
),
139+
),
140+
));
141+
72142
.. _`DQL User Defined Functions`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html

email/spool.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,21 @@ You can also set the time limit in seconds:
141141
Of course you will not want to run this manually in reality. Instead, the
142142
console command should be triggered by a cron job or scheduled task and run
143143
at a regular interval.
144+
145+
.. caution::
146+
147+
When you create a message with SwiftMailer, it generates a ``Swift_Message``
148+
class. If the ``swiftmailer`` service is lazy loaded, it generates instead a
149+
proxy class named ``Swift_Message_<someRandomCharacters>``.
150+
151+
If you use the memory spool, this change is transparent and has no impact.
152+
But when using the filesystem spool, the message class is serialized in
153+
a file with the randomized class name. The problem is that this random
154+
class name changes on every cache clear. So if you send a mail and then you
155+
clear the cache, the message will not be unserializable.
156+
157+
On the next execution of ``swiftmailer:spool:send`` an error will raise because
158+
the class ``Swift_Message_<someRandomCharacters>`` doesn't exist (anymore).
159+
160+
The solutions are either to use the memory spool or to load the
161+
``swiftmailer`` service without the ``lazy`` option (see :doc:`/service_container/lazy_services`).

forms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ from inside a controller::
9696
$form = $this->createFormBuilder($task)
9797
->add('task', TextType::class)
9898
->add('dueDate', DateType::class)
99-
->add('save', SubmitType::class, array('label' => 'Create Task'))
99+
->add('save', SubmitType::class, array('label' => 'Create Post'))
100100
->getForm();
101101

102102
return $this->render('default/new.html.twig', array(

profiler/storage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ directory. If you want to use another location to store the profiles, define the
5050
));
5151
5252
You can also create your own profile storage service implementing the
53-
:class:``Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface`` and
53+
:class:`Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface` and
5454
overriding the ``profiler.storage`` service.

quick_tour/the_big_picture.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ start with ``/**``, whereas regular PHP comments start with ``/*``.
114114

115115
The first value of ``@Route()`` defines the URL that will trigger the execution
116116
of the action. As you don't have to add the host of your application to
117-
the URL (e.g. ```http://example.com``), these URLs are always relative and
117+
the URL (e.g. ``http://example.com``), these URLs are always relative and
118118
they are usually called *paths*. In this case, the ``/`` path refers to the
119119
application homepage. The second value of ``@Route()`` (e.g. ``name="homepage"``)
120120
is optional and sets the name of this route. For now this name is not needed,

reference/configuration/doctrine.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Full Default Configuration
6868
profiling: '%kernel.debug%'
6969
driver_class: ~
7070
wrapper_class: ~
71+
# the DBAL keepSlave option
72+
keep_slave: false
7173
options:
7274
# an array of options
7375
key: []
@@ -209,6 +211,7 @@ Full Default Configuration
209211
logging="%kernel.debug%"
210212
platform-service="MyOwnDatabasePlatformService"
211213
server-version="5.6"
214+
keep-slave="false"
212215
>
213216
<doctrine:option key="foo">bar</doctrine:option>
214217
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
@@ -405,8 +408,6 @@ The following block shows all possible configuration keys:
405408
enum: string
406409
types:
407410
custom: Acme\HelloBundle\MyCustomType
408-
# the DBAL keepSlave option
409-
keep_slave: false
410411
411412
.. code-block:: xml
412413

0 commit comments

Comments
 (0)
0