lithium\data\Model::_key PHP Method

_key() protected static method

Helper for the Model::key() function
See also: lithium\data\Model::key()
protected static _key ( string $key, object $values, string $entity ) : mixed
$key string The key
$values object Object with attributes.
$entity string The fully-namespaced entity class name.
return mixed The key value array or `null` if the `$values` object has no attribute named `$key`
    protected static function _key($key, $values, $entity)
    {
        if (isset($values->{$key})) {
            return array($key => $values->{$key});
        } elseif (!$values instanceof $entity) {
            return array($key => $values);
        }
        return null;
    }