public function login() { if (empty($this->_data)) { // TODO: throw new Exception('Invalid user object'); } $session = new Session('user'); $session->setModel('model', $this); self::$_user = $this; }