Source

						protected function _associate($related) {
		if (!$model = $this->model()) {
			return;
		}

		foreach ((array) $related as $name => $config) {
			if (is_int($name)) {
				$name = $config;
			}
			if (!$relationship = $model::relations($name)) {
				throw new QueryException("Model relationship `{$name}` not found.");
			}
			list($name, $query) = $this->_fromRelationship($relationship);
			$this->join($name, $query);
		}
	}