SymfonyのSession管理
Bagという命名にセンスを感じない
PHP has its own session management system and it requires $_SESSION to access session variables. However, it interferes the code testability while working with OOPs in PHP. To overcome this, Symfony 2 introduces concept of session bag that is linked to encapsulating a specific dataset of attributes. Each of these bags stores all of it’s data under a unique namespace. This allow symfony to co-work with other applications that uses $_SESSION super-global and nall data remains completely with symfony’s session management.
FlashBagってなに?
redirectありきのSessionの管理?
「reqにflash msgを追加し、redirect後にそれを表示する」と書いてる
例とか説明とか
setの仕方、getの仕方
関連
SessionStorageInterface
FlashBagInterface
何が違う?
code:php
// set and get session attributes
$session->set('name', 'Drak');
$session->get('name');
code:php
// set flash messages
$session->getFlashBag()->add('notice', 'Profile updated');