-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Add failing test fixture for AnnotationToAttributeRector #2577
Conversation
# Failing Test for AnnotationToAttributeRector Based on https://getrector.org/demo/4753f273-2649-4a87-bf0f-5ed01e1246e5
BTW. This https://github.com/rectorphp/rector-src/blob/main/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/Doctrine/doctrine_join_table.php.inc test case is wrong in my opinion. First rector does not leave annotation for |
private $users; | ||
} | ||
|
||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how this file differs from https://github.com/rectorphp/rector-src/blob/main/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/Doctrine/doctrine_join_table.php.inc
They seem have the same input example.
It would be better update that one instead adding a duplicate.
#[ORM\ManyToMany(targetEntity: 'User')] | ||
#[ORM\JoinTable(name: 'user_group_role')] | ||
#[ORM\JoinColumn(name: 'user_group_id', referencedColumnName: 'id')] | ||
#[ORM\InverseJoinColumn(name: 'user_id', referencedColumnName: 'id')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought JoinTable
supports nested attributes, but it does not:
#[JoinTable(name: "user_groups")]
#[JoinColumn(name: "user_id", referencedColumnName: "id")]
#[InverseJoinColumn(name: "group_id", referencedColumnName: "id")]
private $groups;
It's quite confusing that ManyToOne
supports nested attributes 🤔 ...ah, they were joined together by commad, it's actually a new attribute. Thanks god for ambiguous syntax :D
#[ManyToOne(targetEntity: Country:class)]
#[JoinColumn(name: "country_code", referencedColumnName: "country_code")]
Ref: https://www.doctrine-project.org/2022/01/11/orm-2.11.html
I can't find issue that lead me to creating this PR so can't find if it was resolved. However it still doesn't work in 0.13.10. |
I think this will be solved now by #2781 🙂 Please rebase on |
I see... it needed move to the |
It passes the CI ✔️ #2785 This fixture is already in there, so I close both PR to avoid duplications. |
Failing Test for AnnotationToAttributeRector
Based on https://getrector.org/demo/4753f273-2649-4a87-bf0f-5ed01e1246e5