doctrine/data-fixtures — pull request #48 by saem (2012-03-26 05:08:11+00:00)
Title: Purge table overridable

This creates a protected purgeTable method, which handles the actual purge, allowing a user to override the purging behaviour. I've outlined my thinking below:

The current choice between delete and truncate doesn't seem to work for me, and a number of others.

As it stands, one can delete, in which case they get unstable IDs, and in large data sets (our fixtures are rather large and only growing) slowness.

Truncate, which doesn't work for MySQL on any remotely interesting database, without the user having to hack around things.

The choices presented are not representative of what people actually want to choose, a number people actually want delete with auto-increment reset, or a truncate with foreign key checks disabled. For a variety of reasons, these are not to be included in this library. I do believe that the DBAL should figure it out, and so I won't rehash that here.

This effectively leaves those, who don't want to copy paste the ORMPurger class just to copy the purge method just to change the purge table behaviour, which is a recipe for disaster, out of luck. Therefore, I believe all that is really required is have the table purging behaviour be overridable. This allows this group to safely extend the purger, keeping all the other benefits (truncation ordering, exclusion, future enhancements and bug fixes etc...) and still easily provide their own behaviour for the actual purge. Since the surface area for this "internal" API is very small, any API/ABI breakage can easily be tolerated.

PS. Unfortunately, this is based off my previous [pull request](https://github.com/doctrine/data-fixtures/pull/44), as that one contains tests to ensure that this actually works. I'm hoping the other one is accepted shortly, and I can rebase here (my current git-fu is lacking).