private function convertColumns(array $row)
    {
        $result = [];

        foreach ($row as $fieldName => $value) {
            if (is_null($value)) {
                $result[$fieldName] = null;
                continue;
            }
            switch($this->columnTypes[$fieldName]) {
                case self::BOOL:
                    $value = is_null($value) ? null : $value == 't';
                    break;
                case self::INTEGER:
                case self::SMALLINT:
                case self::BIGINT:
                    $value = (int) $value;
                    break;
                case self::NUMERIC:
                    $value = (float) $value;
                    break;
                case self::JSON:
                    $value = json_decode($value, true);
                    break;
                case self::HSTORE:
                    $value = self::fromHStore($value);
                    break;
                case self::DATE:
                case self::TIMESTAMP:
                case self::TIMESTAMPTZ:
                    $value = self::fromTimestamp($value);
                    break;
                case self::SMALLINT_ARRAY:
                case self::INTEGER_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : intval($a);
                        }, $value);
                    }
                    break;
                case self::BIGINT_ARRAY:
                case self::NUMERIC_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : doubleval($a);
                        }, $value);
                    }
                    break;
                case self::TEXT_ARRAY:
                case self::VARCHAR_ARRAY:
                case self::CHAR_ARRAY:
                    $value = self::fromArray($value);
                    break;
                case self::HSTORE_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = self::fromHStore($val);
                    }
                    break;
                case self::JSON_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = json_decode($val, true);
                    }
                    break;
                case self::INTERVAL:
                    $value = self::fromInterval($value);
                    break;
            }

            $result[$fieldName] = $value;
        }
        return $result;
    }
private function convertColumns(array $row)
    {
        $result = [];

        foreach ($row as $fieldName => $value) {
            if (is_null($value)) {
                $result[$fieldName] = null;
                continue;
            }
            switch($this->columnTypes[$fieldName]) {
                case self::BOOL:
                    $value = is_null($value) ? null : $value == 't';
                    break;
                case self::INTEGER:
                case self::SMALLINT:
                case self::BIGINT:
                    $value = (int) $value;
                    break;
                case self::NUMERIC:
                    $value = (float) $value;
                    break;
                case self::JSON:
                    $value = json_decode($value, true);
                    break;
                case self::HSTORE:
                    $value = self::fromHStore($value);
                    break;
                case self::DATE:
                case self::TIMESTAMP:
                case self::TIMESTAMPTZ:
                    $value = self::fromTimestamp($value);
                    break;
                case self::SMALLINT_ARRAY:
                case self::INTEGER_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : intval($a);
                        }, $value);
                    }
                    break;
                case self::BIGINT_ARRAY:
                case self::NUMERIC_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : doubleval($a);
                        }, $value);
                    }
                    break;
                case self::TEXT_ARRAY:
                case self::VARCHAR_ARRAY:
                case self::CHAR_ARRAY:
                    $value = self::fromArray($value);
                    break;
                case self::HSTORE_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = self::fromHStore($val);
                    }
                    break;
                case self::JSON_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = json_decode($val, true);
                    }
                    break;
                case self::INTERVAL:
                    $value = self::fromInterval($value);
                    break;
            }

            $result[$fieldName] = $value;
        }
        return $result;
    }
private function convertColumns ( array $ row ) { $ result = [ ] ; foreach ( $ row as $ fieldName => $ value ) { if ( is_null ( $ value ) ) { $ result [ $ fieldName ] = null ; continue ; } switch ( $ this -> columnTypes [ $ fieldName ] ) { case self :: BOOL : $ value = is_null ( $ value ) ? null : $ value == 't' ; break ; case self :: INTEGER : case self :: SMALLINT : case self :: BIGINT : $ value = ( int ) $ value ; break ; case self :: NUMERIC : $ value = ( float ) $ value ; break ; case self :: JSON : $ value = json_decode ( $ value , true ) ; break ; case self :: HSTORE : $ value = self :: fromHStore ( $ value ) ; break ; case self :: DATE : case self :: TIMESTAMP : case self :: TIMESTAMPTZ : $ value = self :: fromTimestamp ( $ value ) ; break ; case self :: SMALLINT_ARRAY : case self :: INTEGER_ARRAY : $ value = self :: fromArray ( $ value ) ; if ( ! is_null ( $ value ) ) { $ value = array_map ( function ( $ a ) { return $ a === 'NULL' ? null : intval ( $ a ) ; } , $ value ) ; } break ; case self :: BIGINT_ARRAY : case self :: NUMERIC_ARRAY : $ value = self :: fromArray ( $ value ) ; if ( ! is_null ( $ value ) ) { $ value = array_map ( function ( $ a ) { return $ a === 'NULL' ? null : doubleval ( $ a ) ; } , $ value ) ; } break ; case self :: TEXT_ARRAY : case self :: VARCHAR_ARRAY : case self :: CHAR_ARRAY : $ value = self :: fromArray ( $ value ) ; break ; case self :: HSTORE_ARRAY : $ array = self :: fromArray ( $ value ) ; $ value = [ ] ; foreach ( $ array as $ val ) { $ value [ ] = self :: fromHStore ( $ val ) ; } break ; case self :: JSON_ARRAY : $ array = self :: fromArray ( $ value ) ; $ value = [ ] ; foreach ( $ array as $ val ) { $ value [ ] = json_decode ( $ val , true ) ; } break ; case self :: INTERVAL : $ value = self :: fromInterval ( $ value ) ; break ; } $ result [ $ fieldName ] = $ value ; } return $ result ; }
Convert pg types to php types

@param array $row

@return array
Convert pg types to php types