getStaticHelperManager get Pix_Helper_Manager from static Pix_Table
public static getStaticHelperManager ( string $type ) : Pix_Helper_Manager | ||
$type | string | |
return | Pix_Helper_Manager |
public function __call($name, $args) { $table = $this->getTable(); if (preg_match('#create_(.+)#', $name, $ret)) { if (count($args) > 0) { return $this->createRelation($ret[1], $args[0]); } else { return $this->createRelation($ret[1]); } } elseif ($table->getHelperManager('row')->hasMethod($name)) { $new_args = $args; array_unshift($new_args, $this); return $table->getHelperManager('row')->callHelper($name, $new_args); } elseif (Pix_Table::getStaticHelperManager('row')->hasMethod($name)) { $new_args = $args; array_unshift($new_args, $this); return Pix_Table::getStaticHelperManager('row')->callHelper($name, $new_args); } else { throw new Pix_Table_Exception(get_class($this) . " 沒有 {$name} 這個 function 喔"); } }
public function autocomplete($name, $args2, $args3) { $res = array(); if (preg_match('#^(.*)::(.*)$#', $name, $matches)) { $methods = get_class_methods($matches[1]); foreach ($methods as $m) { if ($matches[2] === '' or strpos($m, $matches[2]) === 0) { $res[] = $matches[1] . '::' . $m . '()'; } } } elseif (preg_match('#\\$([^$]*)->([^>]*)$#', readline_info('line_buffer'), $matches)) { $obj = self::$_vars[$matches[1]]; if (!is_object($obj) or ($class = get_class($obj)) === false) { return null; } if (is_a($obj, 'Pix_Table_Row')) { // columns foreach (array_keys($obj->getTable()->_columns) as $m) { if ($matches[2] === '' or strpos($m, $matches[2]) === 0) { $res[] = $m; } } // relations foreach (array_keys($obj->getTable()->_relations) as $m) { if ($matches[2] === '' or strpos($m, $matches[2]) === 0) { $res[] = $m; } } // aliases if ($obj->getTable()->_aliases) { foreach (array_keys($obj->getTable()->_aliases) as $m) { if ($matches[2] === '' or strpos($m, $matches[2]) === 0) { $res[] = $m; } } } // hook if ($obj->getTable()->_hooks) { foreach (array_keys($obj->getTable()->_hooks) as $name) { if ($matches[2] === '' or stripos($name, $matches[2]) === 0) { $res[] = $name; } } } // Table Row Helper foreach (array_keys($obj->getTable()->getHelperManager('row')->getMethods()) as $name) { if ($matches[2] === '' or stripos($name, $matches[2]) === 0) { $res[] = $name . '()'; } } // Table Static Helper foreach (array_keys(Pix_Table::getStaticHelperManager('row')->getMethods()) as $name) { if ($matches[2] === '' or stripos($name, $matches[2]) === 0) { $res[] = $name . '()'; } } } $methods = get_class_methods($class); foreach ($methods as $m) { if ($matches[2] === '' or strpos($m, $matches[2]) === 0) { $res[] = $m . '()'; } } } else { foreach (self::findMatch($name) as $o) { $res[] = $o; } } if (count($res) == 0) { return null; } return $res; }
public function __call($func, $args) { if ($this->getTable()->getHelperManager('resultset')->hasMethod($func)) { array_unshift($args, $this); return $this->getTable()->getHelperManager('resultset')->callHelper($func, $args); } elseif (Pix_Table::getStaticHelperManager('resultset')->hasMethod($func)) { array_unshift($args, $this); return Pix_Table::getStaticHelperManager('resultset')->callHelper($func, $args); } throw new Pix_Table_Exception("找不到 function {$func}"); }