find(); $contactIds = array(); while ($exception->fetch()) { $key = "{$exception->contact_id1}_{$exception->contact_id2}"; $contactIds[$exception->contact_id1] = $exception->contact_id1; $contactIds[$exception->contact_id2] = $exception->contact_id2; $dedupeExceptions[$key] = array( 'main' => array('id' => $exception->contact_id1), 'other' => array('id' => $exception->contact_id2), ); } //get the dupe contacts display names. if (!empty($dedupeExceptions)) { $sql = 'select id, display_name from civicrm_contact where id IN ( ' . implode(', ', $contactIds) . ' )'; $contact = CRM_Core_DAO::executeQuery($sql); $displayNames = array(); while ($contact->fetch()) { $displayNames[$contact->id] = $contact->display_name; } foreach ($dedupeExceptions as $key => & $values) { $values['main']['name'] = CRM_Utils_Array::value($values['main']['id'], $displayNames); $values['other']['name'] = CRM_Utils_Array::value($values['other']['id'], $displayNames); } } $this->assign('dedupeExceptions', $dedupeExceptions); } /** * the main function that is called when the page loads, * it decides the which action has to be taken for the page. * * @return null */ public function run() { $this->preProcess(); return parent::run(); } }