Skip to content

Add cautionary advice about SQL reserved words #9541

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

Merged
merged 1 commit into from
Apr 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions security/entity_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ For this entry, suppose that you already have a ``User`` entity inside an
To make things shorter, some of the getter and setter methods aren't shown.
But you can generate these manually or with your own IDE.

.. caution::

In the example above, the User entity's table name is "app_users" because
"USER" is a SQL reserved word. If you wish to call your table name "user",
`it must be quoted with backticks`_ to avoid errors. The annotation should
look like ``@ORM\Table(name="`user`")``.

Next, make sure to :ref:`create the database table <doctrine-creating-the-database-tables-schema>`:

.. code-block:: terminal
Expand Down Expand Up @@ -572,3 +579,4 @@ or worry about it.

.. _fixtures: https://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html
.. _FOSUserBundle: https://github.com/FriendsOfSymfony/FOSUserBundle
.. _`it must be quoted with backticks`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#quoting-reserved-words