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 [];
	}
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 [];
	}
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 [ ] ; }
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.

@return array An array where key are index and value are primary key fieldname.
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 .