postgresql-for-doctrine icon indicating copy to clipboard operation
postgresql-for-doctrine copied to clipboard

Unknown database type text[] requested, Doctrine\DBAL\Platforms\PostgreSQL100Platform may not support it.

Open mathroc opened this issue 5 years ago • 2 comments

I was already using this extension for some functions and tried using the text[] type but doctrine thrown this exception when I tried to use it in an entity.

I was able to fix that by extending TextArray and adding this method:

    /**
     * @return array<string>
     */
    public function getMappedDatabaseTypes(AbstractPlatform $platform): array
    {
        return [self::TYPE_NAME];
    }

is there something wrong with my config ? or maybe that’s something caused by the latest version of doctrine ? if not do you think this method should be added to BaseType ?

doctrine/dbal: 2.10.2 doctrine/orm: 2.7.3 doctrine/doctrine-bundle: 2.1.0 symfony: 5.1.*

mathroc avatar Jul 29 '20 17:07 mathroc

I just realized that it’s very probably because I missed the mapping_types config

while this solves my issue without having to extend the class, it would be nice to implement getMappedDatabaseTypes to avoid having to add this configuration in the first place

feel free to close this issue if you’d rather keep it as it is !

mathroc avatar Jul 30 '20 14:07 mathroc

I think the package can make use of some modernisation for most recent Doctrine versions. Would you be able to help with opening a PR for getMappedDatabaseTypes, please?

martin-georgiev avatar Jan 23 '21 23:01 martin-georgiev