本文整理匯總了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]));
}