Skip to content

Commit b7224c4

Browse files
committed
minor #9541 Add cautionary advice about SQL reserved words (msheakoski)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #9541). Discussion ---------- Add cautionary advice about SQL reserved words I ran into this issue while following the security docs to set up authentication from the database and thought that it would be a helpful tip for future readers. Commits ------- 52af828 Add cautionary advice about SQL reserved words
2 parents 8c84bb1 + 52af828 commit b7224c4

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)