-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Update entity_provider.rst #3116
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
Conversation
you had one user linked to one role, your database might look something like | ||
this: | ||
|
||
.. code-block:: text | ||
|
||
$ mysql> select * from acme_role; | ||
$ mysql> select * from acme_roles; |
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.
thought the best practice is to call the tables singular
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.
@cordoval But the beginning of the example uses @ORM\Table(name="acme_roles")
. So it must be consistent and use the same name until the end
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.
yeah i mean the PR should change the example overall, but i am fine with whatever, just pointing it out
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.
How about changing table names to acme_user, acme_role and acme_user_role? This way the names will be more consistent.
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 always prefer plural table names
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.
Should I change table names to acme_users, acme_roles and acme_user_roles?
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.
A great debate! :). My vote is for singular names. I don't know of any standard, though singular table names are used in the Doctrine documentation (http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#creating-classes-for-the-database for example).
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.
👍 for singular names for this is the default behaviour if you don't set the table name explicitly.
Closing this in favor of #3638, which keeps singular names. Thanks! |
…ere (weaverryan) This PR was merged into the 2.3 branch. Discussion ---------- [#3116] Fixing wrong table name - singular is used elsewhere See #3116. It seems like there's a preference towards singular names, so this fixes the wrong table name, while keeping everything singular. | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3 | Fixed tickets | no Thanks! Commits ------- 7089d97 [#3116] Fixing wrong table name - singular is used elsewhere
No description provided.