protected function _fields($fields, $context) {
		$alias = $context->alias();
		$models = $context->models($this);
		$list = [];

		foreach ($fields as $key => $field) {
			if (!is_string($field)) {
				if (isset($models[$key])) {
					$field = array_fill_keys($field, true);
					$list[$key] = isset($list[$key]) ? array_merge($list[$key], $field) : $field;
				} else {
					$list[0][] = is_array($field) ? reset($field) : $field;
				}
				continue;
			}
			if (preg_match('/^([a-z0-9_-]+|\*)$/i', $field)) {
				isset($models[$field]) ? $list[$field]['*'] = true : $list[$alias][$field] = true;
			} elseif (preg_match('/^([a-z0-9_-]+)\.(.*)$/i', $field, $matches)) {
				$list[$matches[1]][$matches[2]] = true;
			} else {
				$list[0][] = $field;
			}
		}
		return $list;
	}
protected function _fields($fields, $context) {
		$alias = $context->alias();
		$models = $context->models($this);
		$list = [];

		foreach ($fields as $key => $field) {
			if (!is_string($field)) {
				if (isset($models[$key])) {
					$field = array_fill_keys($field, true);
					$list[$key] = isset($list[$key]) ? array_merge($list[$key], $field) : $field;
				} else {
					$list[0][] = is_array($field) ? reset($field) : $field;
				}
				continue;
			}
			if (preg_match('/^([a-z0-9_-]+|\*)$/i', $field)) {
				isset($models[$field]) ? $list[$field]['*'] = true : $list[$alias][$field] = true;
			} elseif (preg_match('/^([a-z0-9_-]+)\.(.*)$/i', $field, $matches)) {
				$list[$matches[1]][$matches[2]] = true;
			} else {
				$list[0][] = $field;
			}
		}
		return $list;
	}
protected function _fields ( $ fields , $ context ) { $ alias = $ context -> alias ( ) ; $ models = $ context -> models ( $ this ) ; $ list = [ ] ; foreach ( $ fields as $ key => $ field ) { if ( ! is_string ( $ field ) ) { if ( isset ( $ models [ $ key ] ) ) { $ field = array_fill_keys ( $ field , true ) ; $ list [ $ key ] = isset ( $ list [ $ key ] ) ? array_merge ( $ list [ $ key ] , $ field ) : $ field ; } else { $ list [ 0 ] [ ] = is_array ( $ field ) ? reset ( $ field ) : $ field ; } continue ; } if ( preg_match ( '/^([a-z0-9_-]+|\*)$/i' , $ field ) ) { isset ( $ models [ $ field ] ) ? $ list [ $ field ] [ '*' ] = true : $ list [ $ alias ] [ $ field ] = true ; } elseif ( preg_match ( '/^([a-z0-9_-]+)\.(.*)$/i' , $ field , $ matches ) ) { $ list [ $ matches [ 1 ] ] [ $ matches [ 2 ] ] = true ; } else { $ list [ 0 ] [ ] = $ field ; } } return $ list ; }
Reformats fields to be alias based.

@see lithium\data\source\Database::fields()
@see lithium\data\source\Database::schema()
@param array $fields Array of fields.
@param object $context Generally a `data\model\Query` instance.
@return array Reformatted fields
Reformats fields to be alias based .