Skip to content

AbstractPlatform::fromInvalidColumnType() exception should not rely on name set #7256

@mvorisek

Description

@mvorisek

Bug Report

Q A
Version 4.0
Previous Version if the bug is a regression 3.x

Summary

The current code relies on column name set - see https://github.com/doctrine/dbal/blob/4.0.0/src/Platforms/AbstractPlatform.php#L163

This is not optimal in sense of OOP/layering as the AbstractPlatform::fromInvalidColumnType() method does not need column name in any sense.

Usecase: https://github.com/atk4/data/blob/af73bf478e/src/Persistence/Sql/Mysql/Query.php#L105

Current behavior

TypeError: Doctrine\DBAL\Exception\InvalidColumnDeclaration::fromInvalidColumnType(): Argument #1 ($columnName) must be of type string, null given, called in /__w/data/data/vendor/doctrine/dbal/src/Platforms/AbstractPlatform.php on line 206

/__w/data/data/vendor/doctrine/dbal/src/Exception/InvalidColumnDeclaration.php:14
/__w/data/data/vendor/doctrine/dbal/src/Platforms/AbstractPlatform.php:206

Expected behavior

No php type error.

How to reproduce

Type::getType('string')->getSQLDeclaration([], $this->connection->getDatabasePlatform());

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions