/** * Fetch records using given criteria returning a Traversable object. * * Note that the traversable object contains a moodle_recordset, so * remember that is important that you call close() once you finish * using it. * * @param string $selectwhere * @param array $params * @param string $sort * @param int $limitfrom * @param int $limitnum * @return \core\dml\recordset_walk|\core\event\base[] */ public function get_events_select_iterator($selectwhere, array $params, $sort, $limitfrom, $limitnum) { if (!$this->init()) { return array(); } if (!($dbtable = $this->get_config('dbtable'))) { return array(); } $sort = self::tweak_sort_by_id($sort); $recordset = $this->extdb->get_recordset_select($dbtable, $selectwhere, $params, $sort, '*', $limitfrom, $limitnum); return new \core\dml\recordset_walk($recordset, array($this, 'get_log_event')); }