Symfony\Component\HttpFoundation\Request::setSession PHP Method

setSession() public method

Sets the Session.
public setSession ( Symfony\Component\HttpFoundation\Session\SessionInterface $session )
$session Symfony\Component\HttpFoundation\Session\SessionInterface The Session
    public function setSession(SessionInterface $session)
    {
        $this->session = $session;
    }

Usage Example

Esempio n. 1
0
 /**
  * Sets a flash notice
  *
  * @param  string  $level    The level of the message: success, warning, danger
  * @param  string  $message  The message
  */
 public function setFlash($level, $message)
 {
     if (!$this->request->hasSession()) {
         $this->request->setSession(new Session());
     }
     $this->flash_notices[] = ['level' => $level, 'message' => $message];
     $this->request->getSession()->getFlashBag()->set('notice', $this->flash_notices);
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Request::setSession