From 521a54142299b1dd7cedbccbc654957f213a7de0 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 11 Aug 2014 17:31:10 +1200 Subject: [PATCH] #16 I think this is the missing fix on the multiple entity load --- civicrm_entity_controller.inc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/civicrm_entity_controller.inc b/civicrm_entity_controller.inc index 283d50cb..740b320f 100644 --- a/civicrm_entity_controller.inc +++ b/civicrm_entity_controller.inc @@ -66,10 +66,13 @@ class CivicrmEntityController extends EntityAPIController { foreach ($ids as $id) { // we can't rely on civicrm api accepting the 'IN' => array(1,5,6) for all entities $civicrm_entities = civicrm_api3($this->entityInfo['description'], 'get', array('id' => $id)); - } - foreach ($civicrm_entities['values'] as $id => $civicrm_entity) { - // @TODO improve this casting. - $queried_entities[$id] = new CivicrmEntity($civicrm_entity, $this->entityType); + if ($civicrm_entities['count']) { + foreach ($civicrm_entities['values'] as $id => $civicrm_entity) { + // @TODO improve this casting. + $queried_entities[$id] = new CivicrmEntity($civicrm_entity, $this->entityType); + + } + } } } catch (Exception $e) {