lithium\data\Model::_key()

protected static method

Helper for the Model::key() function

Parameters

  • string $key

    The key

  • object $values

    Object with attributes.

  • string $entity

    The fully-namespaced entity class name.

Returns

mixed

The key value array or null if the $values object has no attribute named $key

Source

	protected static function _key($key, $values, $entity) {
		if (isset($values->$key)) {
			return [$key => $values->$key];
		} elseif (!$values instanceof $entity) {
			return [$key => $values];
		}
		return null;
	}