public function fillTypeMapProperties($type, $keyToDb, $dbToKey)
    {
        $schema = [];

        if (!array_key_exists($type, $keyToDb)) {
            $schema['type'] = $type;
            return $schema;
        }

        $builder = $keyToDb[$type];

        if (strpos($builder, 'NOT NULL') !== false) {
            $schema['isNotNull'] = true;
            $builder = trim(str_replace('NOT NULL', '', $builder));
        }

        if (strpos($builder, 'AUTO_INCREMENT') !== false) {
            $schema['autoIncrement'] = true;
            $builder = trim(str_replace('AUTO_INCREMENT', '', $builder));
        }

        if (strpos($builder, 'AUTOINCREMENT') !== false) {
            $schema['autoIncrement'] = true;
            $builder = trim(str_replace('AUTOINCREMENT', '', $builder));
        }

        if (strpos($builder, 'IDENTITY PRIMARY KEY') !== false) {
            $schema['isPrimaryKey'] = true;
            $builder = trim(str_replace('IDENTITY PRIMARY KEY', '', $builder));
        }

        if (strpos($builder, 'PRIMARY KEY') !== false) {
            $schema['isPrimaryKey'] = true;
            $builder = trim(str_replace('PRIMARY KEY', '', $builder));
        }

        if (strpos($builder, 'UNSIGNED') !== false) {
            $schema['isUnsigned'] = true;
            $builder = trim(str_replace('UNSIGNED', '', $builder));
        }

        preg_match('/^([a-zA-Z ]+)(\(([0-9,]+)\))?$/', $builder, $matches);

        if (array_key_exists($matches[1], $dbToKey)) {
            if (!empty($matches[3])) {
                $schema['length'] = $matches[3];
            }

            $schema['type'] = $dbToKey[$matches[1]];
        }

        return $schema;
    }
public function fillTypeMapProperties($type, $keyToDb, $dbToKey)
    {
        $schema = [];

        if (!array_key_exists($type, $keyToDb)) {
            $schema['type'] = $type;
            return $schema;
        }

        $builder = $keyToDb[$type];

        if (strpos($builder, 'NOT NULL') !== false) {
            $schema['isNotNull'] = true;
            $builder = trim(str_replace('NOT NULL', '', $builder));
        }

        if (strpos($builder, 'AUTO_INCREMENT') !== false) {
            $schema['autoIncrement'] = true;
            $builder = trim(str_replace('AUTO_INCREMENT', '', $builder));
        }

        if (strpos($builder, 'AUTOINCREMENT') !== false) {
            $schema['autoIncrement'] = true;
            $builder = trim(str_replace('AUTOINCREMENT', '', $builder));
        }

        if (strpos($builder, 'IDENTITY PRIMARY KEY') !== false) {
            $schema['isPrimaryKey'] = true;
            $builder = trim(str_replace('IDENTITY PRIMARY KEY', '', $builder));
        }

        if (strpos($builder, 'PRIMARY KEY') !== false) {
            $schema['isPrimaryKey'] = true;
            $builder = trim(str_replace('PRIMARY KEY', '', $builder));
        }

        if (strpos($builder, 'UNSIGNED') !== false) {
            $schema['isUnsigned'] = true;
            $builder = trim(str_replace('UNSIGNED', '', $builder));
        }

        preg_match('/^([a-zA-Z ]+)(\(([0-9,]+)\))?$/', $builder, $matches);

        if (array_key_exists($matches[1], $dbToKey)) {
            if (!empty($matches[3])) {
                $schema['length'] = $matches[3];
            }

            $schema['type'] = $dbToKey[$matches[1]];
        }

        return $schema;
    }
public function fillTypeMapProperties ( $ type , $ keyToDb , $ dbToKey ) { $ schema = [ ] ; if ( ! array_key_exists ( $ type , $ keyToDb ) ) { $ schema [ 'type' ] = $ type ; return $ schema ; } $ builder = $ keyToDb [ $ type ] ; if ( strpos ( $ builder , 'NOT NULL' ) !== false ) { $ schema [ 'isNotNull' ] = true ; $ builder = trim ( str_replace ( 'NOT NULL' , '' , $ builder ) ) ; } if ( strpos ( $ builder , 'AUTO_INCREMENT' ) !== false ) { $ schema [ 'autoIncrement' ] = true ; $ builder = trim ( str_replace ( 'AUTO_INCREMENT' , '' , $ builder ) ) ; } if ( strpos ( $ builder , 'AUTOINCREMENT' ) !== false ) { $ schema [ 'autoIncrement' ] = true ; $ builder = trim ( str_replace ( 'AUTOINCREMENT' , '' , $ builder ) ) ; } if ( strpos ( $ builder , 'IDENTITY PRIMARY KEY' ) !== false ) { $ schema [ 'isPrimaryKey' ] = true ; $ builder = trim ( str_replace ( 'IDENTITY PRIMARY KEY' , '' , $ builder ) ) ; } if ( strpos ( $ builder , 'PRIMARY KEY' ) !== false ) { $ schema [ 'isPrimaryKey' ] = true ; $ builder = trim ( str_replace ( 'PRIMARY KEY' , '' , $ builder ) ) ; } if ( strpos ( $ builder , 'UNSIGNED' ) !== false ) { $ schema [ 'isUnsigned' ] = true ; $ builder = trim ( str_replace ( 'UNSIGNED' , '' , $ builder ) ) ; } preg_match ( '/^([a-zA-Z ]+)(\(([0-9,]+)\))?$/' , $ builder , $ matches ) ; if ( array_key_exists ( $ matches [ 1 ] , $ dbToKey ) ) { if ( ! empty ( $ matches [ 3 ] ) ) { $ schema [ 'length' ] = $ matches [ 3 ] ; } $ schema [ 'type' ] = $ dbToKey [ $ matches [ 1 ] ] ; } return $ schema ; }
Updates column properties based on schema type map.
@param string $type
@param array $keyToDb
@param array $dbToKey
@return array
Updates column properties based on schema type map .