[TYPO3-mvc] delete all related objects

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon May 30 13:20:37 CEST 2011


Hey,

> When I do it as described above, add a dummy object and remove it
> directly afterwards again, however it does work (all relations gone).
> Which confirms my theory of the dirty flag not being set.
>
> Any ideas?

you're right - I forgot about the dirty flag and the way objectStorages 
are persisted. The improvement of dirty monitoring is on our todo list 
and thus the solution should/could work in future. Until then use either 
your workaround or this:

$relatedObjects = $object->getRelatedObjects();
$relatedObjects->removeAll($object->getRelatedObjects());
$object->setRelatedObjects($relatedObjects);


With this you should be on the save side, even if your "object" is 
returning a cloned objectStorage.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list