addSelect('id', 'contact_id', 'status_id:name', 'status_id:label', 'event_id', 'event_id.title', 'event_id.start_date', 'event_id.end_date') ->addWhere('contact_id', '=', $this->_contactId) ->addOrderBy('event_id.start_date', 'DESC') ->execute() ->indexBy('id'); // Flatten the results in the format expected by the template foreach ($participants as $p) { $p['participant_id'] = $p['id']; $p['status'] = $p['status_id:name']; $p['participant_status'] = $p['status_id:label']; $p['event_id'] = $p['event_id']; $p['event_title'] = $p['event_id.title']; $p['event_start_date'] = $p['event_id.start_date']; $p['event_end_date'] = $p['event_id.end_date']; $event_rows[] = $p; } $this->assign('event_rows', $event_rows); } /** * the main function that is called when the page * loads, it decides the which action has to be taken for the page. * */ public function run() { parent::preProcess(); $this->listParticipations(); } }