Exemplo n.º 1
0
 public static function __callStatic($name, $args)
 {
     if (count($args) == 1 && is_string($args[0]) || count($args) == 2 && is_string($args[0]) && is_array($args[1])) {
         foreach (CONFIG::get("sql") as $value) {
             if (CONFIG::has_attribute($value, "database_alias", true) && CONFIG::has_attribute($value, "model", true)) {
                 $alias = $value["@attributes"]["database_alias"];
                 $model = $value["@attributes"]["model"];
                 $modelname = $args[0];
                 $params = [];
                 if (isset($args[1])) {
                     $params = $args[1];
                 }
                 if ($name == $alias && $modelname == $model) {
                     foreach ($value as $subkey => $subvalue) {
                         if (self::startswith(strtolower($subkey), "select:")) {
                             $handler = new self($alias, CONFIG::content($subvalue), $params);
                             return $handler;
                         }
                     }
                 }
             }
         }
     }
     return null;
 }
Exemplo n.º 2
0
 public static function template($type)
 {
     foreach (CONFIG::get("template") as $value) {
         if (CONFIG::has_attribute($value, "type", true) && strtoupper($value["@attributes"]["type"]) == strtoupper($type)) {
             self::translate($value["@attributes"]["type"], $value);
         }
     }
 }