mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #1398] When using a custom data type, SchemaTool does not pass column length field mapping to relation join columns #9456
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/1398
State: closed
Merged: No
We have a custom data type for storing UUIDs in a BINARY column in MySQL:
...and the following related (example) entities:
In our case, since
SchemaTool::gatherRelationJoinColumns()doesn't copy$fieldMapping['length']to$columnOptions['length']for non-string / custom data types, the resultingCREATE TABLESQL for the OtherThing entity will have a column definition for its association with Thing asthing_id BINARY(0). Of course, MySQL/InnoDB will be unable to create the index for a column with zero length, and multiple exceptions are thrown.I believe the fix here is to simply check whether
$fieldMapping['length']is set, regardless of the value of$fieldMapping['type']. For good measure, I did the same for$fieldMapping['scale']and$fieldMapping['precision'].