lithium\data\collection\MultiKeyRecordSet::_keyIndex()
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
arrayAn 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 [];
}