public static function readone($id) { $class_name = get_called_class(); $key = Lib_Functions::concat_(array($class_name, $id)); $Lib_Memory = Lib_Memory::get_instance(); if (!$Lib_Memory->exist($key)) { $class = new $class_name($id); $t = Lib_Keyvalue::readone($class); if (!$t->body) { $t->body = $class; } $t->body->init_after(); $Lib_Memory->add($key, $t->body, false); } return $Lib_Memory->find($key); }
public function fetch_query($sql, $id = '') { $rtn = array(); $db = $this->get_db(); $query = $db->query($sql); while ($row = $db->fetch_array($query)) { $t = Lib_Functions::clone_o($this); $t->array2obj($row); $id ? $rtn[$row[$id]] = $t : ($rtn[] = $t); } return $rtn; }