Model::__callStatic PHP Method

__callStatic() public static method

Calls static methods directly on the ORMWrapper
public static __callStatic ( string $method, Array $parameters ) : Array
$method string
$parameters Array
return Array
    public static function __callStatic($method, $parameters)
    {
        if (function_exists('get_called_class')) {
            $model = self::factory(get_called_class());
            return call_user_func_array(array($model, $method), $parameters);
        }
    }

Usage Example

示例#1
0
 /**
  * Do some php magic to allow static::find_deleted() to work
  *
  * @param  string $method
  * @param  array  $args
  * @return mixed
  */
 public static function __callStatic($method, $args)
 {
     if (strpos($method, 'find_deleted') === 0) {
         $temp_args = $args;
         $find_type = count($temp_args) > 0 ? array_shift($temp_args) : 'all';
         $options = count($temp_args) > 0 ? array_shift($temp_args) : array();
         return static::deleted($find_type, $options);
     }
     return parent::__callStatic($method, $args);
 }