Skip to content

Commit fe0c7d7

Browse files
committed
[symfony#2562] Minor tweaks to session proxy article
1 parent 6990711 commit fe0c7d7

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

cookbook/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The Cookbook
1313
validation/index
1414
configuration/index
1515
service_container/index
16+
session/index
1617
bundles/index
1718
email/index
1819
testing/index

cookbook/map.rst.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@
132132
* :doc:`/cookbook/service_container/scopes`
133133
* :doc:`/cookbook/service_container/compiler_passes`
134134

135+
* :doc:`/cookbook/session/index`
136+
137+
* :doc:`/cookbook/session/proxy_examples`
138+
135139
* **symfony1**
136140

137141
* :doc:`/cookbook/symfony1`

cookbook/session/proxy_examples.rst

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,26 @@
44
Session Proxy Examples
55
----------------------
66

7-
The session proxy mechanism has a variety of uses, this
8-
example demonstrates two common uses. Rather than injecting
9-
the session handler as normal, a handler is injected into the proxy
10-
and registered with the session storage driver::
7+
The session proxy mechanism has a variety of uses and this example demonstrates
8+
two common uses. Rather than injecting the session handler as normal, a handler
9+
is injected into the proxy and registered with the session storage driver::
1110

12-
<?php
1311
use Symfony\Component\HttpFoundation\Session\Session;
1412
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
1513
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionStorage;
1614

1715
$proxy = new YourProxy(new PdoSessionStorage());
1816
$session = new Session(new NativeSessionStorage($proxy));
1917

20-
The examples below show elaborate on two use-cases.
18+
Below, you'll learn two real examples that can be used for ``YourProxy``:
19+
encryption of session data and readonly guest session.
2120

2221
Encryption of Session Data
2322
--------------------------
2423

25-
If you wanted to encrypt the session data you could use the proxy to encrypt
24+
If you wanted to encrypt the session data, you could use the proxy to encrypt
2625
and decrypt the session as required::
2726

28-
<?php
2927
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
3028

3129
class EncryptedSessionProxy extends SessionHandlerProxy
@@ -54,15 +52,13 @@ and decrypt the session as required::
5452
}
5553
}
5654

57-
58-
Readonly Guest sessions
55+
Readonly Guest Sessions
5956
-----------------------
6057

61-
There are some applications where a session is required for guest
62-
users, but there is no particular need persist the session. In this
63-
case you can intercept the session before it writes::
58+
There are some applications where a session is required for guest users, but
59+
there is no particular need to persist the session. In this case you can
60+
intercept the session before it writes::
6461

65-
<?php
6662
use Foo\User;
6763
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
6864

@@ -86,4 +82,3 @@ case you can intercept the session before it writes::
8682
return parent::write($id, $data);
8783
}
8884
}
89-

0 commit comments

Comments
 (0)