mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3721: [GH-1398] When using a custom data type, SchemaTool does not pass column length field mapping to relation join columns #4568
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?
Originally created by @doctrinebot on GitHub (Apr 29, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of bgetsug:
Url: https://github.com/doctrine/doctrine2/pull/1398
Message:
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'].