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

Martin Kutschker masi-no at spam-typo3.org
Wed Jan 27 13:23:01 CET 2010


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

Like in the Observer/Subject pattern?

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

That's right.

> What you need is really a "I know what I am doing, so just truncate all
> that stuff, now, fast" method.

Yes. And that's also a reason why I wanted the code to be outside of the real repository. I'd call
it a repository maintenance service.

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

So would a simple remove(). AFAIK ExtBase doesn't track foreign keys to the repository in other
repositories or perhaps even other systems.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list