/** * Unsets this user as the current user. * * This means that the data about this user will no longer be stored in a session. * * @param boolean $signalLoader Do not set, except from UserLoader * @return \Gems_User_User (continuation pattern) */ public function unsetAsCurrentUser($signalLoader = true) { // When $oldStore is a \Zend_Session_Namespace, then this user is already the current user. if ($this->isCurrentUser()) { // Get the current variables $oldStore = $this->_vars; $this->_vars = new \ArrayObject(); $this->_vars->setFlags(\ArrayObject::STD_PROP_LIST); foreach ($oldStore as $name => $value) { $this->_vars->offsetSet($name, $value); } // Clean up what is there now in the session. $oldStore->unsetAll(); if ($signalLoader) { // Signal the loader $this->userLoader->unsetCurrentUser(); } } return $this; }
/** * Removes the current user * * @return \Gems_User_UserLoader (continuation pattern) */ public function unsetCurrentUser() { // Remove if the currentUser still sees itself as the current user. if (self::$currentUser instanceof \Gems_User_User && self::$currentUser->isCurrentUser()) { self::$currentUser->unsetAsCurrentUser(false); } self::$currentUser = null; return $this; }