Skip to content

Commit

Permalink
Update Create Documents to fire individual events
Browse files Browse the repository at this point in the history
  • Loading branch information
PineappleIOnic committed Nov 22, 2024
1 parent b5bd17e commit 5431c46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -3425,13 +3425,9 @@ public function createDocuments(string $collection, array $documents, int $batch
}

$documents[$key] = $this->decode($collection, $document);
$this->trigger(self::EVENT_DOCUMENT_CREATE, $documents[$key]);
}

$this->trigger(self::EVENT_DOCUMENTS_CREATE, new Document([
'$collection' => $collection->getId(),
'modified' => array_map(fn ($document) => $document->getId(), $documents)
]));

return $documents;
}

Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/Adapter/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -17036,7 +17036,8 @@ public function testEvents(): void
Database::EVENT_DOCUMENT_SUM,
Database::EVENT_DOCUMENT_INCREASE,
Database::EVENT_DOCUMENT_DECREASE,
Database::EVENT_DOCUMENTS_CREATE,
Database::EVENT_DOCUMENT_CREATE,
Database::EVENT_DOCUMENT_CREATE,
Database::EVENT_DOCUMENT_UPDATE,
Database::EVENT_DOCUMENT_UPDATE,
Database::EVENT_DOCUMENT_UPDATE,
Expand Down

0 comments on commit 5431c46

Please sign in to comment.