/** * 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])); }
/** * {@inheritdoc} */ public function registerBag(SessionBagInterface $bag) { $this->bags[$bag->getStorageKey()] = $bag; }
/** * {@inheritdoc} */ public function registerBag(SessionBagInterface $bag) { $this->bags[$bag->getName()] = $bag; }
/** * {@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; }
/** * 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; }