/** * @param $userId * @return $this */ public function setUserId($userId) { $this->user = $this->db->getRepository('\\Fraym\\User\\Entity\\User')->findOneById($userId); if (!$this->user) { $this->session->destroy(); return $this; } $this->userId = $userId; $this->session->set('userId', $this->userId); if ($this->user) { $this->isLoggedIn = true; $this->user->isOnline = true; $this->user->lastLogin = new \DateTime(); $this->db->persist($this->user); $this->db->flush(); } return $this; }
/** * @param $val * @return bool */ public function setEditMode($val) { $this->inEditMode = $val; $this->session->set('inEditMode', $this->inEditMode); return true; }