Exemplo n.º 1
0
 /**
  * Displays profile if it possible otherwise redirects to login page
  * @return \Framework\Response\Response|\Framework\Response\ResponseRedirect
  */
 public function getAction()
 {
     if (Service::get('security')->isAuthenticated()) {
         return $this->render('get.html', array('posts' => Post::findByParams(array('user_id' => Service::get('session')->get('user')->id))));
     }
     //Sets the return page
     Service::get('session')->set('returnUrl', Registry::getConfig('route')['pattern']);
     return $this->redirect($this->generateRoute('login'), 'You need to login');
 }