src/DataStore/src/TableGateway/TableManagerMysql.php
protected function createColumn(array $fieldData, string $fieldName): ColumnInterface
    {
        $fieldType = $fieldData[self::FIELD_TYPE];

        switch (true) {
            case key_exists($fieldType, $this->fieldClasses[self::COLUMN_SIMPLE]):
                $defaultFieldParameters = $this->parameters[self::COLUMN_SIMPLE];
                $columnClass = $this->fieldClasses[self::COLUMN_SIMPLE][$fieldType];
                break;
            case key_exists($fieldType, $this->fieldClasses[self::COLUMN_LENGTH]):
                $defaultFieldParameters = $this->parameters[self::COLUMN_LENGTH];
                $columnClass = $this->fieldClasses[self::COLUMN_LENGTH][$fieldType];
                break;
            case key_exists($fieldType, $this->fieldClasses[self::COLUMN_PRECISION]):
                $defaultFieldParameters = $this->parameters[self::COLUMN_PRECISION];
                $columnClass = $this->fieldClasses[self::COLUMN_PRECISION][$fieldType];
                break;
            default:
                throw new InvalidArgumentException("Unknown field type: {$fieldType}");
        }

        $args = [];

        foreach ($defaultFieldParameters as $key => $value) {
            if ($key === self::PROPERTY_OPTIONS
                && isset($fieldData[self::FIELD_PARAMS][self::PROPERTY_OPTIONS])
                && key_exists(self::OPTION_AUTOINCREMENT, $fieldData[self::FIELD_PARAMS][self::PROPERTY_OPTIONS])) {
                trigger_error("Autoincrement field is deprecated", E_USER_DEPRECATED);
            }

            if (isset($fieldData[self::FIELD_PARAMS]) && key_exists($key, $fieldData[self::FIELD_PARAMS])) {
                $args[] = $fieldData[self::FIELD_PARAMS][$key];
            } else {
                $args[] = $value;
            }
        }

        array_unshift($args, $fieldName);

        return new $columnClass(...$args);
    }
protected function createColumn(array $fieldData, string $fieldName): ColumnInterface
    {
        $fieldType = $fieldData[self::FIELD_TYPE];

        switch (true) {
            case key_exists($fieldType, $this->fieldClasses[self::COLUMN_SIMPLE]):
                $defaultFieldParameters = $this->parameters[self::COLUMN_SIMPLE];
                $columnClass = $this->fieldClasses[self::COLUMN_SIMPLE][$fieldType];
                break;
            case key_exists($fieldType, $this->fieldClasses[self::COLUMN_LENGTH]):
                $defaultFieldParameters = $this->parameters[self::COLUMN_LENGTH];
                $columnClass = $this->fieldClasses[self::COLUMN_LENGTH][$fieldType];
                break;
            case key_exists($fieldType, $this->fieldClasses[self::COLUMN_PRECISION]):
                $defaultFieldParameters = $this->parameters[self::COLUMN_PRECISION];
                $columnClass = $this->fieldClasses[self::COLUMN_PRECISION][$fieldType];
                break;
            default:
                throw new InvalidArgumentException("Unknown field type: {$fieldType}");
        }

        $args = [];

        foreach ($defaultFieldParameters as $key => $value) {
            if ($key === self::PROPERTY_OPTIONS
                && isset($fieldData[self::FIELD_PARAMS][self::PROPERTY_OPTIONS])
                && key_exists(self::OPTION_AUTOINCREMENT, $fieldData[self::FIELD_PARAMS][self::PROPERTY_OPTIONS])) {
                trigger_error("Autoincrement field is deprecated", E_USER_DEPRECATED);
            }

            if (isset($fieldData[self::FIELD_PARAMS]) && key_exists($key, $fieldData[self::FIELD_PARAMS])) {
                $args[] = $fieldData[self::FIELD_PARAMS][$key];
            } else {
                $args[] = $value;
            }
        }

        array_unshift($args, $fieldName);

        return new $columnClass(...$args);
    }
protected function createColumn ( array $ fieldData , string $ fieldName ) : ColumnInterface { $ fieldType = $ fieldData [ self :: FIELD_TYPE ] ; switch ( true ) { case key_exists ( $ fieldType , $ this -> fieldClasses [ self :: COLUMN_SIMPLE ] ) : $ defaultFieldParameters = $ this -> parameters [ self :: COLUMN_SIMPLE ] ; $ columnClass = $ this -> fieldClasses [ self :: COLUMN_SIMPLE ] [ $ fieldType ] ; break ; case key_exists ( $ fieldType , $ this -> fieldClasses [ self :: COLUMN_LENGTH ] ) : $ defaultFieldParameters = $ this -> parameters [ self :: COLUMN_LENGTH ] ; $ columnClass = $ this -> fieldClasses [ self :: COLUMN_LENGTH ] [ $ fieldType ] ; break ; case key_exists ( $ fieldType , $ this -> fieldClasses [ self :: COLUMN_PRECISION ] ) : $ defaultFieldParameters = $ this -> parameters [ self :: COLUMN_PRECISION ] ; $ columnClass = $ this -> fieldClasses [ self :: COLUMN_PRECISION ] [ $ fieldType ] ; break ; default : throw new InvalidArgumentException ( "Unknown field type: {$fieldType}" ) ; } $ args = [ ] ; foreach ( $ defaultFieldParameters as $ key => $ value ) { if ( $ key === self :: PROPERTY_OPTIONS && isset ( $ fieldData [ self :: FIELD_PARAMS ] [ self :: PROPERTY_OPTIONS ] ) && key_exists ( self :: OPTION_AUTOINCREMENT , $ fieldData [ self :: FIELD_PARAMS ] [ self :: PROPERTY_OPTIONS ] ) ) { trigger_error ( "Autoincrement field is deprecated" , E_USER_DEPRECATED ) ; } if ( isset ( $ fieldData [ self :: FIELD_PARAMS ] ) && key_exists ( $ key , $ fieldData [ self :: FIELD_PARAMS ] ) ) { $ args [ ] = $ fieldData [ self :: FIELD_PARAMS ] [ $ key ] ; } else { $ args [ ] = $ value ; } } array_unshift ( $ args , $ fieldName ) ; return new $ columnClass ( ... $ args ) ; }
Create and return instance of ColumnInterface

@param array $fieldData
@param string $fieldName
@return ColumnInterface
Create and return instance of ColumnInterface