Back to PhocacartFormItems class

Method getColumnType

public static
getColumnType
(mixed $type)

Method getColumnType - Source code

public static function getColumnType($type)
{
    $t = '';
    if ($type != '') {
        $tA = explode(":", $type);
        if (isset($tA[0]) && isset($tA[1]) && $tA[1] != '') {
            $pos = strpos($tA[1], 'varchar');
            if ($pos === 0) {
                $t = $tA[1] . ' NOT NULL DEFAULT \'\'';
            }
            $pos1 = strpos($tA[1], 'int');
            if ($pos1 === 0) {
                $t = $tA[1] . ' NOT NULL DEFAULT \'0\'';
            }
            $pos2 = strpos($tA[1], 'text');
            if ($pos2 === 0) {
                $t = $tA[1];
            }
            $pos3 = strpos($tA[1], 'datetime');
            if ($pos3 === 0) {
                $t = $tA[1] . ' NOT NULL DEFAULT \'0000-00-00 00:00:00\'';
            }
        }
    }
    return $t;
}