[TYPO3-mvc] Clear repository - was: delete/truncate SQL statements

Karsten Dambekalns karsten at typo3.org
Wed Jan 27 13:12:23 CET 2010


Hi.

On 26.01.10 21:47, Martin Kutschker wrote:
>> I wanted to get rid of my demo data without having to use phpMyAdmin or the Mysql shell. So I tried
>> to add a removeAll() method to my repositories. But I lost my way in the numerous classes of the
>> persistence layer.

Well, in FLOW3 we have removeAll(), it basically does findAll() and
calls remove() for every object.

Yes, this is slow.

> Maybe the reference to SQL was misleading. May main question/request is to clear/empty a repository.
> Technically this would boil down to using either DELETE or TRUNCATE statements. But what else needs
> to be done?

That is the part that makes it complicated. Currently I am adding CRUD
"hooks" to the persistence, so when removing an object we need to have
that object and hand it over to whatever method is registered with that
hook ("signal" in FLOW3, coming from the Qt Signal/Slot mechanism).

That means we really need to handle every object, one by one.

What you need is really a "I know what I am doing, so just truncate all
that stuff, now, fast" method. The question here is, again, how far can
that go? If you remove *everything*, it's easy. But what if you want to
clear one repository? You still need to check for pointers to objects in
that repository from elsewhere, so a simple truncation could lead to
severe inconsistencies.

You see, right now I have more questions than solutions. Maybe someone
has a bunch of answers?

Regards,
Karsten


More information about the TYPO3-project-typo3v4mvc mailing list