lithium\data\source\Database::joins()

public method

Returns a join statement for given array of query objects

Parameters

  • object|array $joins

    A single or array of lithium\data\model\Query objects

  • \lithium\data\model\Query $context

Returns

string

Source

	public function joins(array $joins, $context) {
		$result = null;

		foreach ($joins as $key => $join) {
			if ($result) {
				$result .= ' ';
			}
			if (is_array($join)) {
				$join = Libraries::instance(null, 'query', $join, $this->_classes);
			}
			$options['keys'] = ['mode', 'source', 'alias', 'constraints'];
			$result .= $this->renderCommand('join', $join->export($this, $options));
		}
		return $result;
	}