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

Doctrine Annotation to Attributes - InverseJoinColumn is converted to JoinColumn #7346

Closed
Chris53897 opened this issue Aug 5, 2022 · 3 comments · Fixed by rectorphp/rector-src#2781

Comments

@Chris53897
Copy link

Chris53897 commented Aug 5, 2022

Rector version: 80bfee9
Update: I run this under PHP 8.1.

DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES

The InverseJoinColumn ist not converted correct.
It is converted to JoinColumn.

Before:

/**
* @ORM\ManyToMany(targetEntity="App\Entity\Liste")
* @ORM\JoinTable(name="liste_kontingente",
*    joinColumns={@ORM\JoinColumn(name="kontingent_id", referencedColumnName="id")},
*    inverseJoinColumns={@ORM\JoinColumn(name="liste_id", referencedColumnName="id")}
*   )
 */
protected Collection $listen;

After:

#[ORM\ManyToMany(targetEntity: Liste::class)]
#[ORM\JoinTable(name: 'liste_kontingente', joinColumns: [], inverseJoinColumns: [])]
#[ORM\JoinColumn(name: 'kontingent_id', referencedColumnName: 'id')]
#[ORM\JoinColumn(name: 'liste_id', referencedColumnName: 'id')]
protected Collection $listen;

Correct:

#[ORM\ManyToMany(targetEntity: Liste::class)]
#[ORM\JoinTable(name: 'liste_kontingente', joinColumns: [], inverseJoinColumns: [])]
#[ORM\JoinColumn(name: 'kontingent_id', referencedColumnName: 'id')]
#[ORM\InverseJoinColumn(name: 'liste_id', referencedColumnName: 'id')]
protected Collection $listen;
@Chris53897 Chris53897 added the bug label Aug 5, 2022
@samsonasik
Copy link
Member

@acrobat this maybe similar issue with issue that you resolve on PR

Could you verify it and possible provide a patch for it? Thank you.

@javaDeveloperKid
Copy link

Thank you @Chris53897 for reporting this issue. I can see rector did the same error in my app that I'm migrating right now.

@TomasVotruba
Copy link
Member

TomasVotruba commented Aug 18, 2022

The solution is on the way 😀 👍
See rectorphp/rector-src#2781

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

Successfully merging a pull request may close this issue.

4 participants