function getAllPublisher() { $key = 'publisher'; $collection = CacheManager::get($key, TRUE); if ($collection) { return $collection; } $collection = new Collection(); $this->connect(); $result = $this->conn->query("CALL sp_get_all_publisher()"); if ($result) { //$row = $result->fetch_assoc(); while ($obj = $result->fetch_object()) { $publisher = new Publisher(); $publisher->setId($obj->Publisher_id); $publisher->setName($obj->Name); $publisher->setAddress($obj->Address); $publisher->setPhone($obj->Phone); $collection->addItem($publisher, $obj->Publisher_id); } $result->close(); // for fetch_object() } //$result->free_result(); // for fetch_assoc() $this->close(); CacheManager::set($key, $collection, TRUE); return $collection; }