R
R
RJs452014-12-09 11:16:31
PHP
RJs45, 2014-12-09 11:16:31

How to escape table name in doctrine2?

I think this question has been asked before, but I couldn't find an answer.
MySQL database has an Order table. It cannot be renamed within a project. It must be exactly Order.
In Doctrine, an entity is described like this:

/** 
 * @ORM\Entity 
 * @ORM\Table(name="`Order`")
 */
class Order {
.....

Well, it's clear that doctrine-module orm:schema-tool:update --force swears:
You have syntax error near 'Order add invoice_id int default null

How to teach the doctrine to understand that this is the name of the table? Here they say "shield yourself" - it does not help.
Who faced - help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-12-09
@RJs45

This is a very old problem of doctrine.
Alternatively, you can use a similar solution for auto-escaping:
https://gist.github.com/Thinkscape/6713196

M
mind3, 2014-12-09
@mind3

I also advise you to check that the annotations work. Perhaps the settings are taken from Resources/config/doctrine. And don't forget to clear the cache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question