/** * @param $relation * @return mixed * @throws CException */ protected function getRelationDefnition($relation) { $relations = $this->model->relations(); if (!array_key_exists($relation, $relations)) { throw new CException('Relation does not exist'); } $relationDefinition = $relations[$relation]; return $relationDefinition; }