related flag missing bug fix in materio_flag module

This commit is contained in:
Bachir Soussi Chiadmi 2023-06-20 18:26:15 +02:00
parent b2fe1cc963
commit 2e57fbfee6
1 changed files with 34 additions and 24 deletions

View File

@ -65,7 +65,9 @@ class MaterioFlagController extends ControllerBase {
$data = []; $data = [];
foreach ($colls as $id => $collection) { foreach ($colls as $id => $collection) {
$flag_id = $collection->getRelatedFlag()->id(); $relatedflag = $collection->getRelatedFlag();
if ($relatedflag) {
$flag_id = $relatedflag->id();
// get the items // get the items
$itemsids = $this->flagListsService->getFlagListItemIds($flag_id,$id); $itemsids = $this->flagListsService->getFlagListItemIds($flag_id,$id);
@ -91,6 +93,14 @@ class MaterioFlagController extends ControllerBase {
"items" => $items "items" => $items
// "items_uuids" => $items_uuids // "items_uuids" => $items_uuids
); );
} else {
\Drupal::logger('materio_flag')->notice('%colname (%colid): Collection\'s Related flag does not exists.',
[
'%colid' => $collection->id(),
'%colname' => $collection->getName()
]);
}
} }
return new JsonResponse($data); return new JsonResponse($data);