. */ /** * Doctrine_Resource * * @author Konsta Vesterinen * @package Doctrine * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version $Revision$ * @category Object Relational Mapping * @link www.phpdoctrine.com * @since 1.0 */ class Doctrine_Resource { public static function request($url, $request) { $url .= strstr($url, '?') ? '&':'?'; $url .= http_build_query($request); $response = file_get_contents($url); return $response; } public function hydrate(array $array, $model, $config, $passedKey = null) { $collection = new Doctrine_Resource_Collection($model, $config); foreach ($array as $record) { $r = new Doctrine_Resource_Record($model, $config); foreach ($record as $key => $value) { if (is_array($value)) { $r->data[$key] = $this->hydrate($value, $model, $config, $key); } else { $r->data[$key] = $value; } } $collection->data[] = $r; } return $collection; } }