public function loadFromString($data) { if (!empty($data)) { list($id, $str) = unserialize($data); $this->_id = $id; return parent::loadFromString($str); } else { return $this; } }
/** * Load the userAccount from the session * * @param unknown_type $data * @return unknown */ public function loadFromString($data) { if (!empty($data)) { // var_dump(unserialize($data)); list($coreStuff, $str) = unserialize($data); Core::unserialize($coreStuff); $this->userAccount = Core::getUser(); return parent::loadFromString($str); } else { return $this; } }
public function testLoadFromString() { $user = new TUser(self::$mgr); $user->setName('John'); $user->setIsGuest(false); $user->setRoles('Administrator, Writer'); $save = $user->saveToString(); $user2 = new TUser(self::$mgr); $user2->loadFromString($save); self::assertEquals($user, $user2); }