mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #11314] Fix SchemaTool::getSchemaFromMetadata() uniqueConstraint without a predefined name #12934
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/11314
State: closed
Merged: Yes
Bug Report
Summary
SchemaTool can't correctly read a UniqueConstraint when it doesn't have a name specified.
Current behavior
If a unique constraint is specified for a table without a defined name i.e.:
#[ORM\UniqueConstraint(fields: ['field', 'anotherField'])], the reading fails due to a type missmatch here. In such a case the$indexNameis an integer but it should be null. This is correctly applied hereHow to reproduce
Add a
#[ORM\UniqueConstraint(fields: ['field', 'anotherField'])]to any entity and try to dump SQL. You will getExpected behavior
The unique constraint should be loaded correctly and a unique name should be generated for it automatically.