Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Conversation

manindersingh
Copy link
Contributor

No description provided.

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;
Copy link
Contributor

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

Copy link
Member

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

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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).

Copy link
Member

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.

@weaverryan
Copy link
Member

Closing this in favor of #3638, which keeps singular names.

Thanks!

@weaverryan weaverryan closed this Mar 5, 2014
weaverryan added a commit that referenced this pull request Mar 19, 2014
…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
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

Successfully merging this pull request may close these issues.

None yet

6 participants