Skip to content

Commit 780cd22

Browse files
committed
Merge branch '2.3' into 2.4
2 parents a5d1539 + 0428c57 commit 780cd22

File tree

14 files changed

+76
-39
lines changed

14 files changed

+76
-39
lines changed

book/forms.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,8 @@ that will house the logic for building the task form::
10061006
{
10071007
public function buildForm(FormBuilderInterface $builder, array $options)
10081008
{
1009-
$builder->add('task')
1009+
$builder
1010+
->add('task')
10101011
->add('dueDate', null, array('widget' => 'single_text'))
10111012
->add('save', 'submit');
10121013
}

book/page_creation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ an entry when you generated the ``AcmeHelloBundle``:
165165
$collection = new RouteCollection();
166166
$collection->addCollection(
167167
$loader->import('@AcmeHelloBundle/Resources/config/routing.php'),
168-
'/',
168+
'/'
169169
);
170170
171171
return $collection;

book/routing.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,15 @@ is *not* a number).
562562
As a result, a URL like ``/blog/my-blog-post`` will now properly match the
563563
``blog_show`` route.
564564

565-
+--------------------+-----------+-----------------------+
566-
| URL | route | parameters |
567-
+====================+===========+=======================+
568-
| /blog/2 | blog | {page} = 2 |
569-
+--------------------+-----------+-----------------------+
570-
| /blog/my-blog-post | blog_show | {slug} = my-blog-post |
571-
+--------------------+-----------+-----------------------+
565+
+----------------------+-----------+-------------------------+
566+
| URL | route | parameters |
567+
+======================+===========+=========================+
568+
| /blog/2 | blog | {page} = 2 |
569+
+----------------------+-----------+-------------------------+
570+
| /blog/my-blog-post | blog_show | {slug} = my-blog-post |
571+
+----------------------+-----------+-------------------------+
572+
| /blog/2-my-blog-post | blog_show | {slug} = 2-my-blog-post |
573+
+----------------------+-----------+-------------------------+
572574

573575
.. sidebar:: Earlier Routes always Win
574576

@@ -1142,7 +1144,7 @@ instead of simply ``/hello/{name}``:
11421144
$acmeHello = $loader->import(
11431145
"@AcmeHelloBundle/Resources/config/routing.php"
11441146
);
1145-
$acmeHello->setPrefix('/admin');
1147+
$acmeHello->addPrefix('/admin');
11461148
11471149
$collection->addCollection($acmeHello);
11481150

book/validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ section .
11481148
The ``validateValue`` method returns a :class:`Symfony\\Component\\Validator\\ConstraintViolationList`
11491149
object, which acts just like an array of errors. Each error in the collection
11501150
is a :class:`Symfony\\Component\\Validator\\ConstraintViolation` object,
1151-
which holds the error message on its `getMessage` method.
1151+
which holds the error message on its ``getMessage`` method.
11521152

11531153
Final Thoughts
11541154
--------------

components/dependency_injection/factories.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ factory itself as a service:
125125
126126
$container->setDefinition('newsletter_factory', new Definition(
127127
'%newsletter_factory.class%'
128-
))
128+
));
129129
$container->setDefinition('newsletter_manager', new Definition(
130130
'%newsletter_manager.class%'
131131
))->setFactoryService(
@@ -193,7 +193,7 @@ in the previous example takes the ``templating`` service as an argument:
193193
194194
$container->setDefinition('newsletter_factory', new Definition(
195195
'%newsletter_factory.class%'
196-
))
196+
));
197197
$container->setDefinition('newsletter_manager', new Definition(
198198
'%newsletter_manager.class%',
199199
array(new Reference('templating'))

components/form/introduction.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ object to read data off of the correct PHP superglobals (i.e. ``$_POST`` or
8484
:class:`Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationExtension`
8585
to your form factory::
8686

87-
use Symfony\Component\Form\Forms;
88-
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
87+
use Symfony\Component\Form\Forms;
88+
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
8989

90-
$formFactory = Forms::createFormFactoryBuilder()
91-
->addExtension(new HttpFoundationExtension())
92-
->getFormFactory();
90+
$formFactory = Forms::createFormFactoryBuilder()
91+
->addExtension(new HttpFoundationExtension())
92+
->getFormFactory();
9393

9494
Now, when you process a form, you can pass the :class:`Symfony\\Component\\HttpFoundation\\Request`
9595
object to :method:`Symfony\\Component\\Form\\Form::handleRequest`::

cookbook/bundles/remove.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ starting a project, but you'll probably want to eventually remove it.
1717
---------------------------------------------
1818

1919
To disconnect the bundle from the framework, you should remove the bundle from
20-
the ``Appkernel::registerBundles()`` method. The bundle is normally found in
20+
the ``AppKernel::registerBundles()`` method. The bundle is normally found in
2121
the ``$bundles`` array but the AcmeDemoBundle is only registered in a
2222
development environment and you can find him in the if statement after::
2323

cookbook/console/logging.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ container and use it to do the logging::
3434
use Symfony\Component\Console\Input\InputInterface;
3535
use Symfony\Component\Console\Input\InputOption;
3636
use Symfony\Component\Console\Output\OutputInterface;
37-
use \Psr\Log\LoggerInterface;
37+
use Psr\Log\LoggerInterface;
3838

3939
class GreetCommand extends ContainerAwareCommand
4040
{
@@ -150,7 +150,8 @@ Then implement the actual listener::
150150
$this->logger = $logger;
151151
}
152152

153-
public function onConsoleException(ConsoleExceptionEvent $event) {
153+
public function onConsoleException(ConsoleExceptionEvent $event)
154+
{
154155
$command = $event->getCommand();
155156
$exception = $event->getException();
156157

@@ -170,7 +171,7 @@ Then implement the actual listener::
170171
In the code above, when any command throws an exception, the listener will
171172
receive an event. You can simply log it by passing the logger service via the
172173
service configuration. Your method receives a
173-
:class:`Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent`` object,
174+
:class:`Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent` object,
174175
which has methods to get information about the event and the exception.
175176

176177
Logging non-0 exit statuses
@@ -241,7 +242,7 @@ First configure a listener for console terminate events in the service container
241242
Then implement the actual listener::
242243

243244
// src/Acme/DemoBundle/EventListener/ConsoleExceptionListener.php
244-
namespace Acme/DemoBundle\EventListener;
245+
namespace Acme\DemoBundle\EventListener;
245246

246247
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
247248
use Psr\Log\LoggerInterface;
@@ -255,7 +256,8 @@ Then implement the actual listener::
255256
$this->logger = $logger;
256257
}
257258

258-
public function onConsoleTerminate(ConsoleTerminateEvent $event) {
259+
public function onConsoleTerminate(ConsoleTerminateEvent $event)
260+
{
259261
$statusCode = $event->getExitCode();
260262
$command = $event->getCommand();
261263

cookbook/form/dynamic_form_modification.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Adding an Event Subscriber to a Form Class
168168

169169
For better reusability or if there is some heavy logic in your event listener,
170170
you can also move the logic for creating the ``name`` field to an
171-
:ref:`event subscriber <event_dispatcher-using-event-subscribers:ref:>`::
171+
:ref:`event subscriber <event_dispatcher-using-event-subscribers>`::
172172

173173
// src/Acme/DemoBundle/Form/Type/ProductType.php
174174
namespace Acme\DemoBundle\Form\Type;

cookbook/session/sessions_directory.rst

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
.. index::
22
single: Sessions, sessions directory
33

4-
Configuring the Directory where Sessions Files are Saved
4+
Configuring the Directory Where Sessions Files are Saved
55
========================================================
66

7-
By default, Symfony stores the session data in the cache directory. This
8-
means that when you clear the cache, any current sessions will also be
9-
deleted.
7+
By default, Symfony stores the session data in files in the cache
8+
directory ``%kernel.cache_dir%/sessions``. This means that when you clear
9+
the cache, any current sessions will also be deleted.
10+
11+
.. note::
12+
13+
If the ``session`` configuration key is set to ``~``, Symfony will use the
14+
global PHP ini values for ``session.save_handler`` and associated
15+
``session.save_path`` from ``php.ini``.
16+
17+
.. note::
18+
19+
While the Symfony Full Stack Framework defaults to using the
20+
``session.handler.native_file``, the Symfony Standard Edition is
21+
configured to use PHP's global session settings by default and therefor
22+
sessions will be stored according to the ``session.save_path`` location
23+
and will not be deleted when clearing the cache.
1024

1125
Using a different directory to save session data is one method to ensure
1226
that your current sessions aren't lost when you clear Symfony's cache.
@@ -30,18 +44,34 @@ session directory to ``app/sessions``:
3044
# app/config/config.yml
3145
framework:
3246
session:
47+
handler_id: session.handler.native_file
3348
save_path: "%kernel.root_dir%/sessions"
3449
3550
.. code-block:: xml
3651
3752
<!-- app/config/config.xml -->
38-
<framework:config>
39-
<framework:session save-path="%kernel.root_dir%/sessions" />
40-
</framework:config>
53+
<?xml version="1.0" encoding="UTF-8" ?>
54+
<container xmlns="http://symfony.com/schema/dic/services"
55+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
56+
xmlns:framework="http://symfony.com/schema/dic/symfony"
57+
xsi:schemaLocation="http://symfony.com/schema/dic/services
58+
http://symfony.com/schema/dic/services/services-1.0.xsd
59+
http://symfony.com/schema/dic/symfony
60+
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
61+
>
62+
<framework:config>
63+
<framework:session handler-id="session.handler.native_file" />
64+
<framework:session save-path="%kernel.root_dir%/sessions" />
65+
</framework:config>
66+
</container>
4167
4268
.. code-block:: php
4369
4470
// app/config/config.php
4571
$container->loadFromExtension('framework', array(
46-
'session' => array('save-path' => "%kernel.root_dir%/sessions"),
72+
'session' => array(
73+
'handler-id' => 'session.handler.native_file',
74+
'save-path' => '%kernel.root_dir%/sessions',
75+
),
4776
));
77+

0 commit comments

Comments
 (0)