mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
remove: aliasing filter.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user