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

Martin Kutschker masi-no at spam-typo3.org
Thu Jan 28 17:25:50 CET 2010


Karsten Dambekalns schrieb:
> 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.

$repository->removeAll() ~ DELETE FROM <table> *

$repository->clear() ~ TRUNCATE <table> *

DELETE will execute triggers, TRUNCATE won't.

So IMHO it's correct that removeAll() calls remove(), but for me it would also be ok if clear()
doesn't call any hooks or fire messages.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list