[TYPO3-mvc] delete all related objects

Claus Fassing claus at fassing.eu
Fri May 20 07:56:19 CEST 2011


Am 20.05.2011 02:15, schrieb Franz Koch:
> Hey,
> 
>>> i've got a n:m relation with value objects called anhaenge.
>>> Now i want to delete all related objects (anhaenge) from my object.
>>>
>>> How can i do this?
>>
>> Just annotate the embedded object property with "@cascade remove"
> 
> this will only remove the related objects if you delete the parent
> object. If you only want to remove all "anhaenge" objects from the
> parent object, simply replace the objectStorage holding the related
> objects with a empty objectStorage.

Ah, mistaken.

> 
> $foo->setAnhaenge(new Tx_Extbase_Persistence_ObjectStorage());
>

Nice to know. Thank you for the correction Franz.

Greetz Claus




More information about the TYPO3-project-typo3v4mvc mailing list