TYPO3 Extbase how to empty ObjectStorage

前端 未结 2 1697
别那么骄傲
别那么骄傲 2021-01-28 02:17

I want to \"empty\" an ObjectStorage when updating a Object:

It\'s TYPO3 4.6 with a Extbase Extension which allows you to show/add/edit/delete datasets in the frontend.

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-28 02:49

    Call the detach or removeAll methods to remove certain or all objects of the storage.

    /** @var \Tx_Extbase_Persistence_ObjectStorage $organisationPartners */
    $organisationPartners = $organisation->getPartner();
    foreach ($organisationPartners as $partner) {
       $organisationPartners->detach($partner);
    }
    

提交回复
热议问题