/** * Adds a topic to this date. * * @param mixed $topic Topic definition (might be an id, an array or an * object) * @return number addition of all return values, false if none was called */ public function addTopic($topic) { $topic = CourseTopic::toObject($topic); if (!$this->topics->find($topic->id)) { $this->topics[] = $topic; return $this->storeRelations('topics'); } }