mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
UniqueConstraint worked on annotation on Parent class, not anymore after using Attribute #7358
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 @rudy286 on GitHub (Apr 23, 2024).
BC Break Report
Summary
During the upgrade from php 7.4 to php 8.1 (same DB server, with same database_url, from sf 5.4 to 6.4), I have a break while converting Annotation to Attribute: does not work for
ORM\UniqueConstraint.Note: My application extend the user (utilisateur) class from my custom bundle (it is an important detail as we will see in the end):
Previous behavior
This code would produce this migration (
php bin/console make:migration):Current behavior
With attributs, now the code produces this migration (
php bin/console make:migration):How to reproduce
In my class user I tried 2 way to write the UniqueConstraint:
ORMto be more "compliant" with the documentation:According to the documentation, the parameter
fieldis required, so I added it, still produce the not expected migrationI explicitly told doctrine to use attibutes:
Note: If I update the child class 'user' (utilisateur) it will work as the following code shows, BUT, I need my bundle to works for all apps using MyBundle:
And the migration created:
This suggest myBundle can't hold the description of the user entity of all my apps using the bundle.
It looks like all the apps using the same bundle must explicitly tells ORM how to migrate correctly the constraint (why would i create a bundle to extend the parent class then?)
Do you confirm there is a break/regression here, or it is something else?
Any hint welcome !
thanks