/** * Create a new template cohort. * * @param array|stdClass $record * @return template_cohort */ public function create_template_cohort($record = null) { $record = (object) $record; if (!isset($record->templateid)) { throw new coding_exception('The templateid value is required.'); } if (!isset($record->cohortid)) { throw new coding_exception('The cohortid value is required.'); } $tplcohort = new template_cohort(0, $record); $tplcohort->create(); return $tplcohort; }