martin-georgiev / postgresql-for-doctrine

PostgreSQL enhancements for Doctrine. Provides support for advanced data types (json, jssnb, arrays), text search, array operators and jsonb specific functions.

Home Page:https://packagist.org/packages/martin-georgiev/postgresql-for-doctrine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mathroc opened this issue · 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.*

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 !

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?