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 78289f1

Browse filesBrowse files
committed
Updated the session/* articles for Symfony 4
1 parent 1a3be43 commit 78289f1
Copy full SHA for 78289f1

File tree

Expand file treeCollapse file tree

6 files changed

+32
-16
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+32
-16
lines changed

‎session.rst

Copy file name to clipboardExpand all lines: session.rst
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Sessions
33

44
.. toctree::
55
:maxdepth: 1
6-
:glob:
76

8-
session/*
7+
session/sessions_directory
8+
session/avoid_session_start
9+
session/locale_sticky_session
10+
session/limit_metadata_writes
11+
session/php_bridge
12+
session/proxy_examples
13+

‎session/limit_metadata_writes.rst

Copy file name to clipboardExpand all lines: session/limit_metadata_writes.rst
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ than zero:
2323

2424
.. code-block:: yaml
2525
26+
# config/packages/framework.yaml
2627
framework:
2728
session:
2829
metadata_update_threshold: 120
2930
3031
.. code-block:: xml
3132
33+
<!-- config/packages/framework.xml -->
3234
<?xml version="1.0" encoding="UTF-8" ?>
3335
<container xmlns="http://symfony.com/schema/dic/services"
3436
xmlns:framework="http://symfony.com/schema/dic/symfony"
@@ -45,6 +47,7 @@ than zero:
4547
4648
.. code-block:: php
4749
50+
// config/packages/framework.php
4851
$container->loadFromExtension('framework', array(
4952
'session' => array(
5053
'metadata_update_threshold' => 120,

‎session/locale_sticky_session.rst

Copy file name to clipboardExpand all lines: session/locale_sticky_session.rst
+10-8Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,18 @@ via some "Change Locale" route & controller), or create a route with a the :ref:
7373

7474
.. code-block:: yaml
7575
76+
# config/services.yaml
7677
services:
7778
# ...
7879
7980
App\EventSubscriber\LocaleSubscriber:
8081
arguments: ['%kernel.default_locale%']
81-
# redundant if you're using autoconfigure
82-
tags: [kernel.event_subscriber]
82+
# uncomment the next line if you are not using autoconfigure
83+
# tags: [kernel.event_subscriber]
8384
8485
.. code-block:: xml
8586
87+
<!-- config/services.xml -->
8688
<?xml version="1.0" encoding="UTF-8" ?>
8789
<container xmlns="http://symfony.com/schema/dic/services"
8890
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -93,18 +95,21 @@ via some "Change Locale" route & controller), or create a route with a the :ref:
9395
<service id="App\EventSubscriber\LocaleSubscriber">
9496
<argument>%kernel.default_locale%</argument>
9597
96-
<tag name="kernel.event_subscriber" />
98+
<!-- uncomment the next line if you are not using autoconfigure -->
99+
<!-- <tag name="kernel.event_subscriber" /> -->
97100
</service>
98101
</services>
99102
</container>
100103
101104
.. code-block:: php
102105
106+
// config/services.php
103107
use App\EventSubscriber\LocaleSubscriber;
104108
105109
$container->register(LocaleSubscriber::class)
106110
->addArgument('%kernel.default_locale%')
107-
->addTag('kernel.event_subscriber');
111+
// uncomment the next line if you are not using autoconfigure
112+
// ->addTag('kernel.event_subscriber');
108113
109114
That's it! Now celebrate by changing the user's locale and seeing that it's
110115
sticky throughout the request.
@@ -115,7 +120,7 @@ method::
115120
// from a controller...
116121
use Symfony\Component\HttpFoundation\Request;
117122

118-
public function indexAction(Request $request)
123+
public function index(Request $request)
119124
{
120125
$locale = $request->getLocale();
121126
}
@@ -159,9 +164,6 @@ event:
159164
$this->session = $session;
160165
}
161166
162-
/**
163-
* @param InteractiveLoginEvent $event
164-
*/
165167
public function onInteractiveLogin(InteractiveLoginEvent $event)
166168
{
167169
$user = $event->getAuthenticationToken()->getUser();

‎session/php_bridge.rst

Copy file name to clipboardExpand all lines: session/php_bridge.rst
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ for the ``handler_id``:
1515

1616
.. code-block:: yaml
1717
18+
# config/packages/framework.yaml
1819
framework:
1920
session:
2021
storage_id: session.storage.php_bridge
2122
handler_id: ~
2223
2324
.. code-block:: xml
2425
26+
<!-- config/packages/framework.xml -->
2527
<?xml version="1.0" encoding="UTF-8" ?>
2628
<container xmlns="http://symfony.com/schema/dic/services"
2729
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -38,6 +40,7 @@ for the ``handler_id``:
3840
3941
.. code-block:: php
4042
43+
// config/packages/framework.php
4144
$container->loadFromExtension('framework', array(
4245
'session' => array(
4346
'storage_id' => 'session.storage.php_bridge',
@@ -54,13 +57,15 @@ the example below:
5457

5558
.. code-block:: yaml
5659
60+
# config/packages/framework.yaml
5761
framework:
5862
session:
5963
storage_id: session.storage.php_bridge
6064
handler_id: session.handler.native_file
6165
6266
.. code-block:: xml
6367
68+
<!-- config/packages/framework.xml -->
6469
<?xml version="1.0" encoding="UTF-8" ?>
6570
<container xmlns="http://symfony.com/schema/dic/services"
6671
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -77,6 +82,7 @@ the example below:
7782
7883
.. code-block:: php
7984
85+
// config/packages/framework.php
8086
$container->loadFromExtension('framework', array(
8187
'session' => array(
8288
'storage_id' => 'session.storage.php_bridge',

‎session/proxy_examples.rst

Copy file name to clipboardExpand all lines: session/proxy_examples.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ Symfony to use your session handler instead of the default one:
2121

2222
.. code-block:: yaml
2323
24-
# app/config/config.yml
24+
# config/packages/framework.yaml
2525
framework:
2626
session:
2727
# ...
2828
handler_id: App\Session\CustomSessionHandler
2929
3030
.. code-block:: xml
3131
32-
<!-- app/config/config.xml -->
32+
<!-- config/packages/framework.xml -->
3333
<?xml version="1.0" encoding="UTF-8" ?>
3434
<container xmlns="http://symfony.com/schema/dic/services"
3535
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -44,7 +44,7 @@ Symfony to use your session handler instead of the default one:
4444
4545
.. code-block:: php
4646
47-
// app/config/config.php
47+
// config/packages/framework.php
4848
use App\Session\CustomSessionHandler;
4949
$container->loadFromExtension('framework', array(
5050
// ...

‎session/sessions_directory.rst

Copy file name to clipboardExpand all lines: session/sessions_directory.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ this path, update the ``framework.session.save_path`` configuration key:
1111

1212
.. code-block:: yaml
1313
14-
# app/config/config.yml
14+
# config/packages/framework.yaml
1515
framework:
1616
session:
1717
handler_id: session.handler.native_file
1818
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
1919
2020
.. code-block:: xml
2121
22-
<!-- app/config/config.xml -->
22+
<!-- config/packages/framework.xml -->
2323
<?xml version="1.0" encoding="UTF-8" ?>
2424
<container xmlns="http://symfony.com/schema/dic/services"
2525
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -36,7 +36,7 @@ this path, update the ``framework.session.save_path`` configuration key:
3636
3737
.. code-block:: php
3838
39-
// app/config/config.php
39+
// config/packages/framework.php
4040
$container->loadFromExtension('framework', array(
4141
'session' => array(
4242
'handler_id' => 'session.handler.native_file',

0 commit comments

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