@@ -382,7 +382,10 @@ The Symfony2 HttpFoundation Component has a very powerful and flexible session
382382subsystem which is designed to provide session management through a simple
383383object-oriented interface using a variety of session storage drivers.
384384
385- Quick example:
385+ Sessions are used via the simple :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Session `
386+ implementation of :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ SessionInterface ` interface.
387+
388+ Quick example::
386389
387390 use Symfony\\Component\\HttpFoundation\\Session\\Session;
388391
@@ -408,24 +411,25 @@ is called randomly according to PHP's configuration and if called, it is invoked
408411after the `open ` operation). You can read more about this at
409412http://php.net/session.customhandler
410413
414+
411415Native PHP Save Handlers
412416~~~~~~~~~~~~~~~~~~~~~~~~
413417
414- So-called 'native' handlers are session handlers are either compiled into PHP or
415- provided by PHP extensions, such as PHP-Sqlite, PHP-Memcached and so on. The
416- handlers are compiled and can be activated directly in PHP using
418+ So-called 'native' handlers, are session handlers which are either compiled into
419+ PHP or provided by PHP extensions, such as PHP-Sqlite, PHP-Memcached and so on.
420+ The handlers are compiled and can be activated directly in PHP using
417421`ini_set('session.save_handler', $name); ` and are usually configured with
418422`ini_set('session.save_path', $path); ` and sometimes, a variety of other PHP
419423`ini ` directives.
420424
421425Symfony2 provides drivers for native handlers which are easy to configure, these are:
422426
423- * `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler `
424- * `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSqliteSessionHandler `
425- * `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeMemcacheSessionHandler `
426- * `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeMemcachedSessionHandler `
427+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ NativeFileSessionHandler `;
428+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ NativeSqliteSessionHandler `;
429+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ NativeMemcacheSessionHandler `;
430+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ NativeMemcachedSessionHandler `;
427431
428- Example of use:
432+ Example of use::
429433
430434 use Symfony\\Component\\HttpFoundation\\Session\\Session;
431435 use Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage;
@@ -444,12 +448,12 @@ various points in the session workflow.
444448Symfony2 HttpFoudation provides some by default and these can easily serve as
445449examples if you wish to write your own.
446450
447- * `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler `
448- * `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler `
449- * `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler `
450- * `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NullSessionHandler `
451+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ PdoSessionHandler `;
452+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ MemcacheSessionHandler `;
453+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Ha
F440
ndler\\ MemcachedSessionHandler `;
454+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ NullSessionHandler `;
451455
452- Example:
456+ Example::
453457
454458 use Symfony\\Component\\HttpFoundation\\Session\\Session;
455459 use Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorage;
@@ -467,7 +471,7 @@ OOP paradigm. To help overcome this Symfony2 uses 'session bags' linked to the
467471session to encapsulate a specific dataset like 'attributes' or 'flash messages'.
468472
469473This approach also mitigates namespace pollution within the `$_SESSION `
470- super-global because each bag stores all it's data under a unique namespace.
474+ super-global because each bag stores all its data under a unique namespace.
471475This allows Symfony2 to peacefully co-exist with other applications or libraries
472476that might use the `$_SESSION ` super-global and all data remains completely
473477compatible with Symfony2's session management.
@@ -479,13 +483,14 @@ bag types if necessary.
479483Attributes
480484~~~~~~~~~~
481485
482- The purpose of the bags implementing the ` AttributeBagInterface ` is to handle
483- session attribute storage. This might include things like user ID, and remember
484- me login settings or other user based state information.
486+ The purpose of the bags implementing the :class: ` Symfony \\ Component \\ HttpFoundation \\ Session \\ Attribute \\ AttributeBagInterface `
487+ is to handle session attribute storage. This might include things like user ID,
488+ and remember me login settings or other user based state information.
485489
486- * `AttributeBag ` - this is the standard default implementation.
487- * `NamespacedAttributeBag ` - this implementation allows for attributes to be
488- stored in a structured namespace.
490+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Attribute\\ AttributeBag `
491+ This is the standard default implementation.
492+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Attribute\\ NamespacedAttributeBag `
493+ This implementation allows for attributes to be stored in a structured namespace.
489494
490495Any plain `key => value ` storage system is limited in the extent to which
491496complex data can be stored since each key must be unique. You can achieve
@@ -500,14 +505,14 @@ store it again.
500505 'b' => 'f4a7b1f3')
501506
502507So any processing of this might quickly get ugly, even simply adding a token to
503- the array:
508+ the array::
504509
505510 $tokens = $session->get('tokens');
506511 $tokens['c'] = $value;
507512 $session->set('tokens', $tokens);
508513
509514With structured namespacing, the the key can be translated to the array
510- structure like this using a namespace character (defaults to `/ `).
515+ structure like this using a namespace character (defaults to `/ `)::
511516
512517 $session->set('tokens/c', $value);
513518
@@ -516,19 +521,21 @@ This way you can easily access a key within the stored array directly and easily
516521Flash messages
517522~~~~~~~~~~~~~~
518523
519- The purpose of the `FlashBagInterface ` is to provide a way of settings and
520- retrieving messages on a per session basis. The usual workflow for flash
521- messages would be set in an request, and displayed on page redirect. For
522- example, a user submits a form which hits an update controller, and after
523- processing the controller redirects the page to either the updated page or a
524- error page. Flash messages set in the previous page request would be displayed
525- immediately on the subsequent page load for that session. This is however just
526- one application for flash messages.
527-
528- * `AutoExpireFlashBag ` - This implementation messages set in one page-load will
524+ The purpose of the :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Flash\\ FlashBagInterface `
525+ is to provide a way of settings and retrieving messages on a per session basis.
526+ The usual workflow for flash messages would be set in an request, and displayed
527+ on page redirect. For example, a user submits a form which hits an update
528+ controller, and after processing the controller redirects the page to either the
529+ updated page or a error page. Flash messages set in the previous page request
530+ would be displayed immediately on the subsequent page load for that session.
531+ This is however just one application for flash messages.
532+
533+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Flash\\ AutoExpireFlashBag `
534+ This implementation messages set in one page-load will
529535 be available for display only on the next page load. These messages will auto
530536 expire regardless of if they are retrieved or not.
531- * `FlashBag ` - In this implementation, messages will remain in the session until
537+ * :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Flash\\ FlashBag `
538+ In this implementation, messages will remain in the session until
532539 they are explicitly retrieved or cleared. This makes it possible to use ESI
533540 caching.
534541
@@ -539,7 +546,7 @@ Symfony2 is designed from the ground up with code-testability in mind. In order
539546to make your code which utilises session easily testable we provide two separate
540547mock storage mechanisms for both unit testing and functional testing.
541548
542- Testing code using real sessions is trick because PHP's workflow state is global
549+ Testing code using real sessions is tricky because PHP's workflow state is global
543550and it is not possible to have multiple concurrent sessions in the same PHP
544551process.
545552
@@ -555,7 +562,7 @@ Unit Testing
555562
556563For unit testing where it is not necessary to persist the session, you should
557564simply swap out the default storage engine with
558- `Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage `.
565+ :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ MockArraySessionStorage `::
559566
560567 use Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage;
561568 use Symfony\\Component\\HttpFoundation\\Session\\Session;
@@ -567,39 +574,39 @@ Functional Testing
567574
568575For functional testing where you may need to persist session data across
569576separate PHP processes, simply change the storage engine to
570- `Symfony\\Component\\HttpFoundation\\SessionMockFileSessionStorage `.
577+ :class: `Symfony\\ Component\\ HttpFoundation\\ Session \\ Storage \\ MockFileSessionStorage `::
571578
572579 use Symfony\\Component\\HttpFoundation\\Session\\Session;
573- use Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ MockFileessionStorage ;
580+ use Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockFileSessionStorage ;
574581
575582 $session = new Session(new MockFileSessionStorage());
576583
577584PHP 5.4 compatibility
578585~~~~~~~~~~~~~~~~~~~~~
579586
580- Since PHP 5.4.0, ` \ SessionHandler ` and ` \ SessionHandlerInterface ` are available.
581- Symfony 2.1 provides forward compatibility for the ` \ SessionHandlerInterface ` so
587+ Since PHP 5.4.0, :phpclass: ` SessionHandler ` and :phpclass: ` SessionHandlerInterface ` are available.
588+ Symfony 2.1 provides forward compatibility for the :phpclass: ` SessionHandlerInterface ` so
582589it can be used under PHP 5.3. This greatly improves inter-operability with other
583590libraries.
584591
585- `\SessionHandler ` is a special PHP internal class which exposes native save
586- handlers to PHP user-space. You can read more about it at
587- http://php.net/sessionhandler.
592+ :phpclass: `SessionHandler ` is a special PHP internal class which exposes native save
593+ handlers to PHP user-space.
588594
589595In order to provide a solution for those using PHP 5.4, Symfony2 has a special
590- class called `Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler `
596+ class called :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ NativeSessionHandler `
591597which under PHP 5.4, extends from `\SessionHandler ` and under PHP 5.3 is just a
592598empty base class. This provides some interesting opportunities to leverage
593599PHP 5.4 functionality if it is available.
594600
595601Handler Proxy
596602~~~~~~~~~~~~~
597603
598- `SessionStorage ` injects storage handlers into a handler proxy. The reason for
599- this is that under PHP 5.4, all handlers implement `\SessionHandlerInterface `
604+ :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ NativeSessionStorage `
605+ injects storage handlers into a handler proxy. The reason for this is that
606+ under PHP 5.4, all handlers implement :phpclass: `SessionHandlerInterface `
600607including native handlers (those which activate internal PHP/PHP-extension
601608handlers. Native handlers under PHP 5.4 will be children of
602- ` \ SessionHandler ` which allows one to intercept and modify even native session
609+ :phpclass: ` SessionHandler ` which allows one to intercept and modify even native session
603610handlers.
604611
605612In order to manage all of this, Symfony2 uses a proxy handler object. It means
0 commit comments