lithium\data\model\Query::joins()

public method

Set and get the joins

Parameters

  • string $name

    Optional name of join. Unless two parameters are passed, this parameter is regonized as $join.

  • object|string $join

    A single query object or an array of query objects

Returns

mixed

The joins array or a join array if $name is set. Returns null if a join doesn't exist.

Source

	public function joins($name = null, $join = null) {
		if (is_array($name)) {
			$join = $name;
			$name = null;
		}
		if ($join) {
			if (!$name) {
				$this->_config['joins'][] = $join;
			} else {
				$this->_config['joins'][$name] = $join;
			}
			return $this;
		}
		if (!$name) {
			return $this->_config['joins'];
		}
		if (isset($this->_config['joins'][$name])) {
			return $this->_config['joins'][$name];
		}
	}