From 52af828abd1fe1e2f123135ab4309cc5a4b46cc3 Mon Sep 17 00:00:00 2001 From: Michael Sheakoski Date: Mon, 2 Apr 2018 21:03:54 -0400 Subject: [PATCH] Add cautionary advice about SQL reserved words --- security/entity_provider.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/security/entity_provider.rst b/security/entity_provider.rst index cd1f631d0db..24ee63a5160 100644 --- a/security/entity_provider.rst +++ b/security/entity_provider.rst @@ -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 `: .. code-block:: terminal @@ -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