/** * Get the entity related to user in the active identity. * * @return Phalcon\UserPlugin\Models\User\User */ public function getUser() { $identity = $this->session->get('auth-identity'); if (!isset($identity['id'])) { return false; } $user = User::findFirstById($identity['id']); if ($user == false) { throw new Exception('The user does not exist'); } return $user; }