[TYPO3-mvc] When do things actually get written to the database?

Sebastian Kurfürst sebastian at typo3.org
Tue Jul 21 09:27:59 CEST 2009


Hi Nikolas,

> 			$currentItem = $itemRepository->findByUid($uid);
> 			$currentItem->setState(0);
> 			$itemRepository->replace($currentItem,
> $currentItem);
You do not need this line. Actually after ending the current request,  
the element is updated automatically.

> Well the funny (or perhaps obvious - but not to me) - thing is that
> 'itemRepository->findByState(1))' also returns items that have been
> update  a few lines above.
This is because updates are delayed until the request has been  
finished processing.

Try to fetch the Tx_Extbase_Persistence_Manager and do a persistAll()  
- though this is not (yet) public API, thus there might be some issues  
with it.


Greets,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list