public static detectType ( $type ) : string | ||
return | string |
public static function detectType($type)
{
static $cache;
if (!isset($cache[$type])) {
$cache[$type] = 'string';
foreach (self::$typePatterns as $s => $val) {
if (preg_match("#^({$s})\$#i", $type)) {
return $cache[$type] = $val;
}
}
}
return $cache[$type];
}
/** * @return array */ protected function getTables() { $tables = []; foreach ($this->structure->getTables() as $table) { if ($table['view'] === FALSE) { foreach ($this->structure->getColumns($table['name']) as $column) { $tables[$table['name']][$column['name']] = \Nette\Database\Helpers::detectType($column['nativetype']); } } } return $tables; }