Closed rootpd closed 9 years ago
Nice work @rootpd
I've found an issue after all, maybe you'll be able help me with it (maybe it's not an issue). PostgreSQL returns integer array column defined as _int4
which is not recognized by default by doctrine.
Correct approach seems to be calling this in main class of bundle using this type:
class BayloftIdentityBundle extends Bundle
{
public function boot()
{
$em = $this->container->get('doctrine.orm.entity_manager');
$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('_int4','int_array');
}
}
Without this, schema update will work first time but on each update when column is already present, user will get following command exception:
[Doctrine\DBAL\DBALException]
Unknown database type _int4 requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it.
Can you figure out the way how to make this seamless?
Maybe we should just use _int4
as our name for the type. Does that work?
It worked, didn't see the forest for the trees. Tried to figure out how to register the extra type when this is just really enough. Thanks :).
Abstract class was created for PostgreSQL arrays and all subclasses (int_array, text_array) are meant to be its extension.
Tests and Readme.md were updated. Tests now check also for type of returned array - array of integers for int_array, array of strings for text_array.