_contactIds = $this->getContactIDsFromComponent($this->_entityIds, 'civicrm_case_contact', 'case_id' ); } /** * Get the query mode (eg. CRM_Core_BAO_Query::MODE_CASE) * * @return int */ public function getQueryMode() { return CRM_Contact_BAO_Query::MODE_CASE; } /** * Override of CRM_Core_Form_Task::orderBy() * * @return string */ public function orderBy() { if (empty($this->_entityIds)) { return ''; } $order_array = []; foreach ($this->_entityIds as $item) { // Ordering by conditional in mysql. This evaluates to 0 or 1, so we // need to order DESC to get the '1'. $order_array[] = 'case_id = ' . CRM_Core_DAO::escapeString($item) . ' DESC'; } return 'ORDER BY ' . implode(',', $order_array); } /** * Get the name of the table for the relevant entity. * * @return string */ public function getTableName() { return 'civicrm_case'; } /** * Get the entity alias field. * * @return string */ public function getEntityAliasField() { return 'case_id'; } }