@@ -477,7 +477,7 @@ public function before(string $event, string $name, callable $callback): static
477477 * @param array<string>|null $listeners List of listeners to silence; if null, all listeners will be silenced
478478 * @return T
479479 */
480- public function silent (callable $ callback , array $ listeners = null ): mixed
480+ public function silent (callable $ callback , ? array $ listeners = null ): mixed
481481 {
482482 $ previous = $ this ->silentListeners ;
483483
@@ -1143,14 +1143,14 @@ public function delete(?string $database = null): bool
11431143 * @param string $id
11441144 * @param array<Document> $attributes
11451145 * @param array<Document> $indexes
1146- * @param array<string> $permissions
1146+ * @param array<string>|null $permissions
11471147 * @param bool $documentSecurity
11481148 * @return Document
11491149 * @throws DatabaseException
11501150 * @throws DuplicateException
11511151 * @throws LimitException
11521152 */
1153- public function createCollection (string $ id , array $ attributes = [], array $ indexes = [], array $ permissions = null , bool $ documentSecurity = true ): Document
1153+ public function createCollection (string $ id , array $ attributes = [], array $ indexes = [], ? array $ permissions = null , bool $ documentSecurity = true ): Document
11541154 {
11551155 $ permissions ??= [
11561156 Permission::create (Role::any ()),
@@ -1437,7 +1437,7 @@ public function deleteCollection(string $id): bool
14371437 * @throws StructureException
14381438 * @throws Exception
14391439 */
1440- public function createAttribute (string $ collection , string $ id , string $ type , int $ size , bool $ required , mixed $ default = null , bool $ signed = true , bool $ array = false , string $ format = null , array $ formatOptions = [], array $ filters = []): bool
1440+ public function createAttribute (string $ collection , string $ id , string $ type , int $ size , bool $ required , mixed $ default = null , bool $ signed = true , bool $ array = false , ? string $ format = null , array $ formatOptions = [], array $ filters = []): bool
14411441 {
14421442 $ collection = $ this ->silent (fn () => $ this ->getCollection ($ collection ));
14431443
@@ -1802,7 +1802,7 @@ public function updateAttributeDefault(string $collection, string $id, mixed $de
18021802 * @return Document
18031803 * @throws Exception
18041804 */
1805- public function updateAttribute (string $ collection , string $ id , string $ type = null , int $ size = null , bool $ required = null , mixed $ default = null , bool $ signed = null , bool $ array = null , string $ format = null , ?array $ formatOptions = null , ?array $ filters = null , ?string $ newKey = null ): Document
1805+ public function updateAttribute (string $ collection , string $ id , ? string $ type = null , ? int $ size = null , ? bool $ required = null , mixed $ default = null , ? bool $ signed = null , ? bool $ array = null , ? string $ format = null , ?array $ formatOptions = null , ?array $ filters = null , ?string $ newKey = null ): Document
18061806 {
18071807 return $ this ->updateAttributeMeta ($ collection , $ id , function ($ attribute , $ collectionDoc , $ attributeIndex ) use ($ collection , $ id , $ type , $ size , $ required , $ default , $ signed , $ array , $ format , $ formatOptions , $ filters , $ newKey ) {
18081808 $ altering = !\is_null ($ type )
@@ -3425,13 +3425,9 @@ public function createDocuments(string $collection, array $documents, int $batch
34253425 }
34263426
34273427 $ documents [$ key ] = $ this ->decode ($ collection , $ document );
3428+ $ this ->trigger (self ::EVENT_DOCUMENT_CREATE , $ documents [$ key ]);
34283429 }
34293430
3430- $ this ->trigger (self ::EVENT_DOCUMENTS_CREATE , new Document ([
3431- '$collection ' => $ collection ->getId (),
3432- 'modified ' => array_map (fn ($ document ) => $ document ->getId (), $ documents )
3433- ]));
3434-
34353431 return $ documents ;
34363432 }
34373433
0 commit comments