public function getRelation($name) { if (!isset($this->_relations[$name])) { throw new InvalidArgumentException("{$this->modelClass} has no relation: {$name}"); } return $this->_relations[$name]; }