public static function get() { $list = parent::get(); if ($res = self::query_remote("SELECT * FROM RestDataObject")) { foreach ($res as $item) { $list->push(new ExternalMySQLDataObject($item)); } } return $list; }
/** * Child classes should call $list = parent::get(); */ public static function get() { $list = parent::get(); $result = self::service()->request('/RestDataObject'); if ($result->getStatusCode() == 200) { $body = Convert::json2obj($result->getBody()); if (isset($body->items)) { foreach ($body->items as $item) { $list->push(new ExternalRestDataObject((array) $item)); } } } return $list; }
/** * Child classes should call $list = parent::get(); */ public static function get() { $list = parent::get(); $cursor = self::collection()->find(); if ($cursor) { foreach ($cursor as $key => $document) { //var_dump($document); if (is_object($document["_id"])) { $class = get_called_class(); $list->push(new $class($document)); } else { $collection->remove(array('_id' => $key)); } } } return $list; }
public function flushCache($persistent = true) { if ($persistent) { Aggregate::flushCache($this->class); } if ($this->class == 'ExternalDataObject') { ExternalDataObject::$_cache_get_one = array(); return $this; } $classes = class_parents($this->class) + array($this->class => $this->class); foreach ($classes as $class) { if (isset(ExternalDataObject::$_cache_get_one[$class])) { unset(ExternalDataObject::$_cache_get_one[$class]); } } $this->extend('flushCache'); return $this; }