Skip to content

Commit 770127b

Browse files
committed
Tweaking new message about SQL reserved keywords
1 parent 6724fe7 commit 770127b

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

book/doctrine.rst

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ be.
1919
If you prefer to use raw database queries, this is easy, and explained
2020
in the ":doc:`/cookbook/doctrine/dbal`" cookbook entry.
2121

22-
23-
Doctrine doesn't auto-escape reserved SQL keywords, for further reference
24-
check Doctrine manual, `Reserved SQL keywords documentation`_.
25-
26-
2722
You can also persist data to `MongoDB`_ using Doctrine ODM library. For
2823
more information, read the ":doc:`/cookbook/doctrine/mongodb`" cookbook
2924
entry.
@@ -234,23 +229,6 @@ in a number of different formats including YAML, XML or directly inside the
234229
The table name is optional and if omitted, will be determined automatically
235230
based on the name of the entity class.
236231

237-
.. tip::
238-
239-
When using another library or program (ie. Doxygen) that uses annotations,
240-
you must use the ``@IgnoreAnnotation`` annotation to indicate which annotations
241-
Symfony and Doctrine should ignore. This annotation should be placed in the
242-
comment block of the class it applies to. Failing to do so may result
243-
in an exception being thrown.
244-
245-
For example, to prevent the ``@fn`` annotation from throwing an exception,
246-
add the following::
247-
248-
/**
249-
* @IgnoreAnnotation("fn")
250-
*
251-
*/
252-
class Product
253-
254232
Doctrine allows you to choose from a wide variety of different field types,
255233
each with their own options. For information on the available field types,
256234
see the :ref:`book-doctrine-field-types` section.
@@ -264,6 +242,29 @@ see the :ref:`book-doctrine-field-types` section.
264242
the ``use Doctrine\ORM\Mapping as ORM;`` statement, which *imports* the
265243
``ORM`` annotations prefix.
266244

245+
.. caution::
246+
247+
Be careful that your class name and properties aren't mapped to a protected
248+
SQL keyword (such as ``group`` or ``user``). For example, if your entity
249+
class name is ``Group``, then, by default, your table name will be ``group``,
250+
which will cause an SQL error in some engines. See Doctrine's
251+
`Reserved SQL keywords documentation`_ on how to properly escape these
252+
names.
253+
254+
.. note::
255+
256+
When using another library or program (ie. Doxygen) that uses annotations,
257+
you should place the ``@IgnoreAnnotation`` annotation on the class to
258+
indicate which annotations Symfony should ignore.
259+
260+
For example, to prevent the ``@fn`` annotation from throwing an exception,
261+
add the following::
262+
263+
/**
264+
* @IgnoreAnnotation("fn")
265+
*/
266+
class Product
267+
267268
Generating Getters and Setters
268269
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269270

0 commit comments

Comments
 (0)