lithium\data\collection\MultiKeyRecordSet::_keyIndex()

protected method

Extracts the numerical indices of the primary keys in numerical indexed row data. Works only for the main row data and not for relationship rows.

This method will also correctly detect primary keys which don't come first or are in sequential order.

Returns

array

An array where key are index and value are primary key fieldname.

Source

	protected function _keyIndex() {
		if (!($model = $this->_model) || !isset($this->_columns[''])) {
			return [];
		}
		$index = 0;

		foreach ($this->_columns as $name => $fields) {
			if ($name === '') {
				$flip = array_flip($fields);

				$keys = array_flip($model::meta('key'));
				$keys = array_intersect_key($flip, $keys);

				foreach ($keys as &$key) {
					$key += $index;
				}
				return array_flip($keys);
			}
			$index += count($fields);
		}
		return [];
	}