8000 Add cautionary advice about SQL reserved words · symfony/symfony-docs@52af828 · GitHub
[go: up one dir, main page]

Skip to content

Commit 52af828

Browse files
msheakoskijaviereguiluz
authored andcommitted
Add cautionary advice about SQL reserved words
1 parent 8c84bb1 commit 52af828

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

security/entity_provider.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ For this entry, suppose that you already have a ``User`` entity inside an
140140
To make things shorter, some of the getter and setter methods aren't shown.
141141
But you can generate these manually or with your own IDE.
142142

143+
.. caution::
144+
145+
In the example above, the User entity's table name is "app_users" because
146+
"USER" is a SQL reserved word. If you wish to call your table name "user",
147+
`it must be quoted with backticks`_ to avoid errors. The annotation should
148+
look like ``@ORM\Table(name="`user`")``.
149+
143150
Next, make sure to :ref:`create the database table <doctrine-creating-the-database-tables-schema>`:
144151

145152
.. code-block:: terminal
@@ -572,3 +579,4 @@ or worry about it.
572579

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

0 commit comments

Comments
 (0)
0