Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
change targetEntity format#10696
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| /** | ||
| * @ORM\OneToMany( | ||
| * targetEntity="Comment", | ||
| * targetEntity="App\Entity\Comment", |
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 think it is better to suggestComment::class because if you refactor namespace it will be picked up and you don't have to edit a bunch of strings
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.
The similar approach was applied before, so I decide to follow it. Do you want to suggest rework everywhere toClassNmae::class?
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.
Ah, then leave it like this in PR. I think reworking it everywhere would be a nice addition. Not sure what docs team thinks about it
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.
If team decide to rework everything, so, I'm in ;)
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.
Using the class constant doesn't work in annotations if I am not completely mistaken.
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.
It works, I used it like:
* @ORM\ManyToOne(targetEntity=Comment::class) * @ORM\JoinColumn(name="id", referencedColumnName="id")When you refactor and maybe change the namespace, it changes the use statements (not sure about strings but it didn't work for me most of the times) so that is an advantage on usingComment::class instead of"App\Entity\Comment".
kunicmarko20Nov 25, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
After discussing this with@ostrolucky on slack, it seems that:
clicking on
mappedBy="foo"/inversedBy="foo"
dosen't work withComment::class also if you rename the class it still staysComment::class so I guess FQCN is still better
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.
You mean "clicking on" IDE?
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.
ye, clicking on the name of the var in your IDE (phpstorm in my case).
kunicmarko20 left a comment
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.
Thank you for your help and congrats on your first contribution!
osavchenko commentedNov 25, 2018 via email
Alright, thank uppity for explanation. So, this issue is resolved?нд, 25 лист. 2018, 18:01 Marko Kunic користувач notifications@github.comпише: … ***@***.**** commented on this pull request. ------------------------------ In best_practices/business-logic.rst <#10696 (comment)> : > @@ -198,7 +198,7 @@ looking for mapping information:: /** *@Orm\OneToMany( - * targetEntity="Comment", + * targetEntity="App\Entity\Comment", ye, clicking on the name of the var in your IDE (phpstorm in my case). — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#10696 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAlqKnj8rdxXzw2qtSzcYAUu34ISXc59ks5uyr7tgaJpZM4Yv8bL> . |
javiereguiluz commentedNov 27, 2018
Oleksandr thanks a lot for fixing this. It was a great first contribution to Symfony Docs! |
osavchenko commentedNov 28, 2018
Thank you,@javiereguiluz! And thanks a lot for reviewers for hints. |
According to#9401 improved support for entity namespace aliases