Annotation to attributes rector isn't complete
b1rdex opened this issue ยท 2 comments
Hi! I found some problems using rector to transform annotations to attributes:
-
@Index
must be moved out of@Table
(Table attribute was deleted as it's not necessary anymore) -
same for unique constraints
(Table attribute was deleted as it's not necessary anymore) -
@JoinTable
should be split
I had to do these modifications manually after the initial rector run โ these were not easy to find, partly because of silent BC by Doctrine.
I found some information about these in doctrine/orm#9334 (comment) and https://www.doctrine-project.org/projects/doctrine-orm/en/2.11/reference/attributes-reference.html
I've reported the same issue here rectorphp/rector#7163 (comment)
Hi @b1rdex ,
thanks for the report and git diffs. It really helped me to understand what needed to changed and how ๐ At start I got really confused by Doctrine docs, that suprisingly has no manual how to upgrade even basic annotations.
Instead of making the basic rule do too many things like before, we introduced a new rule NestedAnnotationToAttributeRector
and move the nested annotation extract there: rectorphp/rector-src#2781
That way we have 2 clean rules with separated jobs ๐
This is already deployed in the latest Rector dev-main
. Any feedback from real project with Doctrine annotation is welcomed ๐