/** * Setup test data * * @param type $parser * @param type $path * @param type $inits */ public function __construct($parser, $path = array(), $inits = array()) { $this->sort_default = self::$DEFAULT_SORT; $this->limit_default = self::$DEFAULT_LIMIT; $this->offset_default = self::$DEFAULT_OFFSET; parent::__construct($parser, $path, $inits); }
/** * Check for Doctrine class types * * @param string $method * @param mixed $return (reference) */ protected function sanity($method, &$return) { if ($method == 'rec_query') { if (!is_a($return, 'Doctrine_Query')) { throw new Exception("rec_query must return Doctrine_Query"); } } elseif ($method == 'rec_fetch') { if (!is_a($return, 'Doctrine_Record')) { throw new Exception("rec_fetch must return Doctrine_Record"); } } else { parent::sanity($method, $return); } }
/** * Converts a path into a route. Returns false if the route is invalid. * * @param array $path * @return array $route */ protected function _path_to_route($path) { if (!is_array($path) || count($path) < 1) { return false; } $route = array(); while (count($path)) { $route[] = array_shift($path); $so_far = implode($this->delimiter, $route); if (!isset($this->routes[$so_far])) { return false; //bad route } $cls = $this->routes[$so_far]; $type = Rframe_Resource::get_rel_type($cls); if (count($path) && $type == Rframe_Resource::ONE_TO_MANY) { array_shift($path); //remove a UUID } } return $route; }