Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotation to attributes rector isn't complete #116

Closed
b1rdex opened this issue Jul 19, 2022 · 2 comments
Closed

Annotation to attributes rector isn't complete #116

b1rdex opened this issue Jul 19, 2022 · 2 comments
Assignees

Comments

@b1rdex
Copy link

b1rdex commented Jul 19, 2022

Hi! I found some problems using rector to transform annotations to attributes:

  1. @Index must be moved out of @Table
    image (Table attribute was deleted as it's not necessary anymore)

  2. same for unique constraints
    image (Table attribute was deleted as it's not necessary anymore)

  3. @JoinTable should be split

image

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

@javaDeveloperKid
Copy link

I've reported the same issue here rectorphp/rector#7163 (comment)

@TomasVotruba
Copy link
Member

TomasVotruba commented Aug 18, 2022

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 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants