Skip to content

Commit

Permalink
Merge pull request #800 from UN-OCHA/berliner/errors
Browse files Browse the repository at this point in the history
Prevent errors
  • Loading branch information
berliner authored Nov 15, 2023
2 parents aec80b7 + 8c9c1cf commit 7e5d10f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ private function getPlanEntities($entity_ref_code = NULL) {
/** @var \Drupal\ghi_plans\Plugin\EndpointQuery\EntityQuery $query */
$query = $this->getQueryHandler('entity');
$plan_data = $query->getEntity('plan', $context_object->getSourceId());
return [
return $plan_data ? [
$plan_data->id() => $plan_data,
];
] : [];
}

$filter = NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ private function assureDisaggregatedData() {
/** @var \Drupal\ghi_plans\Plugin\EndpointQuery\AttachmentQuery $attachment_query */
$attachment_query = $this->getEndpointQueryManager()->createInstance('attachment_query');
$attachment_data = $attachment_query->getAttachmentDataWithDisaggregatedData($this->id);
if (!$attachment_data) {
return;
}
$this->setRawData($attachment_data);
$this->updateMap();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public function getParentIds() {
if (empty($entity_version->value->support)) {
return [];
}
if (!is_array($entity_version->value->support)) {
return [];
}
$first_ref = reset($entity_version->value->support);
if (property_exists($first_ref, 'planEntityIds') && !empty($first_ref->planEntityIds)) {
return $first_ref->planEntityIds;
Expand Down

0 comments on commit 7e5d10f

Please sign in to comment.