SymfonyのSession管理
https://symfony.com/doc/3.4/components/http_foundation/sessions.html
Session Bag
PHPのクソ仕様に抗うためのSymfony固有の概念
要はSymfony上でSession管理をする際に使うやつ
Bagという命名にセンスを感じない
https://medium.com/spoken-by-you/session-bag-encapsulating-dataset-of-attributes-in-symfony-2-10688c500aae
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後にそれを表示する」と書いてる
https://symfony.com/doc/3.4/components/http_foundation/sessions.html#flash-messages
例とか説明とか
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');