Skip to content

Commit 4792316

Browse files
Copilotabnegate
andauthored
add symmetric _deletedAt handling in getDocument and getAttributeProjection
Agent-Logs-Url: https://github.com/utopia-php/database/sessions/68d0e3c1-0a6e-486c-875a-24e50241ccf4 Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com>
1 parent 5b44243 commit 4792316

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/Database/Adapter/SQL.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ public function getDocument(string $collection, string $id, array $queries = [],
386386
$document['$updatedAt'] = $document['_updatedAt'];
387387
unset($document['_updatedAt']);
388388
}
389+
if (\array_key_exists('_deletedAt', $document)) {
390+
$document['$deletedAt'] = $document['_deletedAt'];
391+
unset($document['_deletedAt']);
392+
}
389393
if (\array_key_exists('_permissions', $document)) {
390394
$document['$permissions'] = json_decode($document['_permissions'] ?? '[]', true);
391395
unset($document['_permissions']);
@@ -1707,6 +1711,10 @@ protected function getAttributeProjection(array $selections, string $prefix = ''
17071711
$selections[] = $this->getInternalKeyForAttribute('$updatedAt');
17081712
$selections = \array_diff($selections, ['$updatedAt']);
17091713
}
1714+
if (\in_array('$deletedAt', $selections)) {
1715+
$selections[] = $this->getInternalKeyForAttribute('$deletedAt');
1716+
$selections = \array_diff($selections, ['$deletedAt']);
1717+
}
17101718
if (\in_array('$collection', $selections)) {
17111719
$selections[] = $this->getInternalKeyForAttribute('$collection');
17121720
$selections = \array_diff($selections, ['$collection']);

0 commit comments

Comments
 (0)