[Flow] Enum in Doctrine
Schulz, Maximilian
Maximilian.Schulz at hs-hannover.de
Thu May 21 14:33:56 CEST 2015
Hello,
i am encountering a Problem with a database column of type ENUM.
Doctrine throws a DBALException with the Message "Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it".
I already tried fixing this issue with the following two solutions i found:
1.
Mapping the type "enum" to the Doctrine type "string"
2.
Creating a class for type "enum" to be used in doctrine.
I found these solutions in the doctrine documentation here: http://doctrine-orm.readthedocs.org/en/latest/cookbook/mysql-enums.html
However both solutions kind of fail for the same reason, which is the step of letting doctrine know about this.
For the first solution i need to get the actual database connection to be able to call this on it: $conn->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
As i have also found out, the database connection in flow is inside the entityManager which is a protected property on the persistenceManager, so i cannot access it in my package. (Btw im trying to do this from the Package.php of my Package)
For the second solution you need to add the newly created types to doctrine by this static method call: Doctrine\DBAL\Types\Type::addType('enum', 'MyProject\DBAL\EnumType');
This call does not change anything, i still get the Exception.
Any ideas on how to get Doctrine to understand enums in TYPO3 Flow would be greatly appreciated.
Regards
More information about the Flow
mailing list