lithium\data\model\Query::_entityConditions PHP Method

_entityConditions() protected method

Called by conditions when it is called as a get and no condition is set.
protected _entityConditions ( ) : array
return array Returns an array in the following format: `([model's primary key'] => [that key set in the record])`.
    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();
    }