本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionBagInterface类的典型用法代码示例。如果您正苦于以下问题:PHP SessionBagInterface类的具体用法?PHP SessionBagInterface怎么用?PHP SessionBagInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SessionBagInterface类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerBag
/**
* {@inheritdoc}
*/
public function registerBag(SessionBagInterface $bag)
{
$this->bags[$bag->getStorageKey()] = $bag;
}
示例2: registerBag
/**
* {@inheritdoc}
*/
public function registerBag(SessionBagInterface $bag)
{
$this->bags[$bag->getName()] = $bag;
}
示例3: registerBag
/**
* {@inheritdoc}
*/
public function registerBag(SessionBagInterface $bag)
{
if ($this->started) {
throw new \LogicException('Cannot register a bag when the session is already started.');
}
$this->bags[$bag->getName()] = $bag;
}
示例4: registerBag
/**
* Registers a SessionBagInterface for use.
*
* @param SessionBagInterface $bag
*/
public function registerBag(SessionBagInterface $bag)
{
if ($bag->getName() == "attributes") {
$bag->set('_security_secured_area', serialize(new UsernamePasswordToken('user', 'user', 'in_memory', array('ROLE_USER'))));
}
$this->bags[$bag->getName()] = $bag;
}
示例5: addErrorFlash
/**
* Sets error type flash message.
*
* @param Event $event
* @param string $eventName
*/
public function addErrorFlash(Event $event, $eventName)
{
$errorMessages = $this->getErrorMessages();
if (!isset($errorMessages[$eventName])) {
throw new InvalidArgumentException('This event does not correspond to a known flash message.');
}
$this->flashBag->add('danger', $this->translator->trans($errorMessages[$eventName]));
}