/**
* Method _extra_enum_set_handle
*
* @param $string $string [explicite description]
*
* @return String
*/
public function _extra_enum_set_handle($string = null)
{
$find = ['/(^\w+\(?)/', '/(\)$)/']; // reg 'a(' or ')'
$replace_type = preg_replace($find, '', $string); /// replace first string of type ex set('es','ea') or enum('1','11')
return $replace_type;
}
if (!isset($match[2])) {
switch (strtoupper($match[0])) {
//type enum need extra handle
case 'ENUM':
$add_field_str .= "\t\t\t\t'constraint' => [" . $this->_extra_enum_set_handle($column['Type']) . "],\n";
break;
// Add SET type
case 'SET':
$add_field_str .= "\t\t\t\t'constraint' => [" . $this->_extra_enum_set_handle($column['Type']) . "],\n";
break;
default:
$add_field_str .= "\t\t\t\t'constraint' => '" . strtoupper($column['Type']) . "'," . "\n";
break;
}
}
else{
/// constraint not number
if(is_numeric($match[2])){
$add_field_str .= "\t\t\t\t'constraint' => '" . strtoupper($match[2]) . "'," . "\n";
}
}
'field' => array(
'type' => 'SET',
'constraint SET' => ['aaa','bbb','ccc','ddd','ffff'],
),