[TYPO3-mvc] Modifies objects inside objectStorages don't seem to get persisted

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Jan 24 16:10:30 CET 2011


Hey,

>> It's already sufficient to trigger the attach and add one of the
>> containing objects (or the modified one) again, but it's still no
>> solution of course, but maybe a bit "cleaner" then adding an ugly hack.
>
> In this specific case I'm working with a n:1 relationship (Many
> addresses can have one country)
> Therefore I only have a $address->setCountry(Tx_...Country $country)
> method, which doesn't mark the address Object as dirty automatically.

But in this case persistence should work unless the address object 
itself is stored in a unmodified objectStorage.

The only way not working correctly is a scenario like this:

// childObjects is a objectStorage of course
foreach ($aggregateRoot->getChildObjects() as $childObject) {
	$childObject->setFoo('bar');
}

In this case the change would not be persisted because the childObjects 
objectStorage itself is not dirty and thus it's objects don't get 
persisted too.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list