Exemple #1
0
 /**
  * Delegates find calls through to the finder
  */
 public static function __callStatic($method, $params)
 {
     if (preg_match('/^(find|all$|byId$|one)/', $method)) {
         return Finder\Wizard::fromClass(get_called_class())->dispatch($method, $params);
     } elseif (preg_match('/^(hasOne|hasMany|belongsTo)$/', $method)) {
         $refl = new \ReflectionClass('\\Pheasant\\Relationships\\' . ucfirst($method));
         array_unshift($params, get_called_class());
         return $refl->newInstanceArgs($params);
     } else {
         throw new \BadMethodCallException("No static method {$method} available");
     }
 }