Skip to content

Commit 84c0c74

Browse files
abnegateclaude
andcommitted
(fix): skip decorators during silenced (internal) operations
Decorators should not run during silent() calls which are internal operations like old-document fetches in updateDocument(). Without this, decorator-injected attributes ($databaseId, $collectionId) leak into write operations, causing Structure validator "Unknown attribute" errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 93b7f4d commit 84c0c74

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Database/Database.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,10 @@ public function addHook(\Utopia\Query\Hook $hook): static
12201220
*/
12211221
protected function decorateDocument(Event $event, Document $collection, Document $document): Document
12221222
{
1223+
if ($this->eventsSilenced) {
1224+
return $document;
1225+
}
1226+
12231227
foreach ($this->decorators as $decorator) {
12241228
$document = $decorator->decorate($event, $collection, $document);
12251229
}

0 commit comments

Comments
 (0)