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

protected method

Will return a find first condition on the associated model if a record is connected. Called by conditions when it is called as a get and no condition is set.

Returns

array

Returns an array in the following format: ([model's primary key'] => [that key set in the record]).

Source

	protected function _entityConditions() {
		if (!$this->_entity || !($model = $this->_config['model'])) {
			return array();
		}
		$key = $model::key($this->_entity->data());

		if (!$key && $this->type() !== 'create') {
			throw new ConfigException('No matching primary key found.');
		}
		if (is_array($key)) {
			return $key;
		}

		$key = $model::meta('key');
		$val = $this->_entity->{$key};
		return $val ? array($key => $val) : array();
	}