[TYPO3-mvc] Bug or feature: implementation of Iterator and ArrayAccess of Tx_Extbase_Persistence_ObjectStorage does't not work as expected
Marc Bastian Heinrichs
typo3 at mbh-web.de
Fri Feb 18 14:51:25 CET 2011
Hej,
> Hey MB, (you yourself pointed me to this :P)
:-)
But Maba is the "official" common short version for Marc Bastian. :-)
>> $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);
> }
Jep, if $modelBs is the clone, returned by $modelA->getModelBs(), this
will work.
> 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).
For shure that's a good point. Thinking about this later :-)
Best
Maba
More information about the TYPO3-project-typo3v4mvc
mailing list