remove: aliasing filter.

This commit is contained in:
Darshan 2025-05-06 12:14:54 +05:30
parent 9ec897f7d6
commit b1735ef945

View file

@ -1,39 +0,0 @@
<?php
namespace Appwrite\Utopia\Request\Filters;
use Appwrite\Utopia\Request\Filter;
class DatabaseAliases extends Filter
{
// Map old params to new
private const PARAMS_MAP = [
'documentId' => 'rowId',
'attributes' => 'columns',
'collectionId' => 'tableId',
'attributeId' => 'columnId',
'relatedCollection' => 'relatedTable',
'relatedCollectionId' => 'relatedTableId',
];
public function parse(array $content, string $model): array
{
return $this->overrideDatabaseParams($content, $model);
}
protected function overrideDatabaseParams(array $content, string $model): array
{
if (!str_starts_with($model, 'databases.')) {
return $content;
}
$intersect = array_intersect_key(self::PARAMS_MAP, $content);
foreach ($intersect as $oldKey => $newKey) {
$content[$newKey] = $content[$oldKey];
unset($content[$oldKey]);
}
return $content;
}
}