Purge table overridable #48

wants to merge 2 commits into

2 participants


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, 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).


Is this feature scheduled to be added in master?

I would need it at work, since we are using the fixtures on a legacy db and some tables are not yet mapped as an entity.


I don't see this being merged any time soon, and as I don't have this itch any more I'll not be scratching it further.


@saem saem closed this Dec 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment