[TYPO3-mvc] Bug or feature: implementation of Iterator and ArrayAccess of Tx_Extbase_Persistence_ObjectStorage does't not work as expected

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri Feb 18 13:11:52 CET 2011


Hey MB, (you yourself pointed me to this :P)

> $modelA->modelBs m:m relation to $modelB
> $modelBs = $modelA->getModelBs()
>
> So $modelBs is an objectStorage object.
>
> This does not work:
> foreach($modelBs as $modelB) {
>      $modelBs->detach($modelB);
> }

DDD wise, shouldn't it be more like this?

foreach($modelBs as $modelB) {
	$modelA->removeModelB($modelB);
}

Just for the case that the removal of a child modelB could/would have to 
trigger some domain related tasks which are kept track on by $modelA. 
I'm just mentioning this, because I became a bit sensible for this 
during the discussion with Thomas on returning clones by getters (which 
DDD wise would make sense for getters returning objectStorages and 
having dedicated API methods to add/remove items).


Didn't have time to check your mentioned behavior yet.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list