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'];
|
$flagcollid = $post_data['flagcollid'];
|
||||||
|
|
||||||
$flagcoll = $this->flagListsService->getFlaggingCollectionById($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
|
// TODO: warning, sometimes relatedFlag deos not exists
|
||||||
// $flag = $flagcoll->getRelatedFlag();
|
// $flag = $flagcoll->getRelatedFlag();
|
||||||
|
|
||||||
|
// finaly delete the flag collection
|
||||||
|
$flagcoll->delete();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
// 'result' => $flag,
|
// 'result' => $flag,
|
||||||
'id' => $flagcollid
|
'id' => $flagcollid
|
||||||
|
|
Loading…
Reference in New Issue