fixed flaglistitems not being deleted when flagcoll is
This commit is contained in:
parent
eaa6d6eebd
commit
a6f28da58f
|
@ -125,11 +125,21 @@ class MaterioFlagController extends ControllerBase {
|
|||
$flagcollid = $post_data['flagcollid'];
|
||||
|
||||
$flagcoll = $this->flagListsService->getFlaggingCollectionById($flagcollid);
|
||||
// dump($flagcoll);
|
||||
$flagcoll->delete();
|
||||
|
||||
$relatedflag = $flagcoll->getRelatedFlag();
|
||||
|
||||
// flaglistitems are not deleted with the flagcoll
|
||||
$itemsids = $this->flagListsService->getFlagListItemIds($relatedflag->id(),$flagcoll->id());
|
||||
foreach ($this->flagListsService->getFlagListItems($itemsids) as $item) {
|
||||
$item->delete();
|
||||
}
|
||||
|
||||
// TODO: warning, sometimes relatedFlag deos not exists
|
||||
// $flag = $flagcoll->getRelatedFlag();
|
||||
|
||||
// finaly delete the flag collection
|
||||
$flagcoll->delete();
|
||||
|
||||
$data = [
|
||||
// 'result' => $flag,
|
||||
'id' => $flagcollid
|
||||
|
|
Loading…
Reference in New Issue