doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.77k stars 224 forks source link

Error purging when table name is a keyword #243

Closed orasik closed 8 years ago

orasik commented 8 years ago

In Mysql, when table name is a keyword (order for example) it will give the error:

An exception occurred while executing 'DELETE FROM order': 
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order' at line 1 

I did a fix and it can be found here: https://github.com/Orasik/data-fixtures/pull/1/files

Ocramius commented 8 years ago

If you use the ORM, then please remember that identifiers are not quoted automatically by default due to case sensitivity issues.

See http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/limitations-and-known-issues.html#identifier-quoting-and-legacy-databases

Defining if a symbol is to be quoted can be done in the mappings, for example via @Table(name="order")