doctrine / data-fixtures

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

Purger cannot purge tables with special names #258

Closed bugadani closed 7 years ago

bugadani commented 7 years ago

I have a table named 'order' which ORMPurger is not able to purge because it does not quite the table name properly.

[Doctrine\DBAL\Exception\SyntaxErrorException] 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 MariaDB server version for the right syntax to use near 'order' at line 1

Ocramius commented 7 years ago

Table should be mapped as following (or equivalent) in order for the quoting strategy to pick it up:

@ORM\Column(name="`order`")
bugadani commented 7 years ago

Curiously it works everywhere else and even if I choose truncate over delete as the purging method. I accept that I should configure my stuff correctly but if something fails in one place only, I don't believe that is my fault.

Ocramius commented 7 years ago

It may be that the method is not quoting correctly, for which we'd start from a test case in ORM first.

The idea is that if there is a bug, in general, we should fix the cause, not the effects: I pointed you to the entrance of the rabbit hole if you want to explore 😁

On 28 Jun 2017 8:37 AM, "Buga Dániel" notifications@github.com wrote:

Curiously it works everywhere else and even if I choose truncate over delete as the purging method. I accept that I should configure my stuff correctly but if something fails in one place only, I don't believe that is my fault.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/doctrine/data-fixtures/issues/258#issuecomment-311570309, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakD70_hk14INnU4nioMMIjSewGv3Tks5sIfTAgaJpZM4OG0Pv .

bugadani commented 7 years ago

Very well, thank you for your time and effort 👍