[TYPO3-mvc] Flush persistence cache

Nikolas Hagelstein lists at shr-now.de
Wed Jul 7 14:23:10 CEST 2010


> Something like that:
> 
> $myFirstField = $fieldRepository->findOneByUid(4711);
> // Do something with $myFirstField
> $fieldRepository->flushRegisteredObjects();
> $mySecondField = $fieldRepository->findOneByUid(4711);

Kinda messy but...:
Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getIdentityMap
()->unregisterObject($myFirstField);

This will force the repository to perform a query to the database see:
---
	public function findByUid($uid) {
		if ($this->identityMap->hasIdentifier($uid,
$this->objectType)) {
			$object =
$this->identityMap->getObjectByIdentifier($uid, $this->objectType);
		} else {
	....


Cheers,
Nikolas





More information about the TYPO3-project-typo3v4mvc mailing list