@@ -2471,14 +2471,14 @@ protected function execute(mixed $stmt): bool
24712471 * @throws DuplicateException
24722472 * @throws \Throwable
24732473 */
2474- public function createDocuments (Document $ collection , array $ documents, bool $ ignore = false ): array
2474+ public function createDocuments (Document $ collection , array $ documents ): array
24752475 {
24762476 if (empty ($ documents )) {
24772477 return $ documents ;
24782478 }
24792479
24802480 // Pre-filter existing UIDs to prevent race-condition duplicates.
2481- if ($ ignore ) {
2481+ if ($ this -> skipDuplicates ) {
24822482 $ collectionId = $ collection ->getId ();
24832483 $ name = $ this ->filter ($ collectionId );
24842484 $ uids = \array_filter (\array_map (fn (Document $ doc ) => $ doc ->getId (), $ documents ), fn ($ v ) => $ v !== null );
@@ -2649,9 +2649,9 @@ public function createDocuments(Document $collection, array $documents, bool $ig
26492649 $ batchKeys = \implode (', ' , $ batchKeys );
26502650
26512651 $ stmt = $ this ->getPDO ()->prepare ("
2652- {$ this ->getInsertKeyword ($ ignore )} {$ this ->getSQLTable ($ name )} {$ columns }
2652+ {$ this ->getInsertKeyword ()} {$ this ->getSQLTable ($ name )} {$ columns }
26532653 VALUES {$ batchKeys }
2654- {$ this ->getInsertSuffix ($ ignore , $ name )}
2654+ {$ this ->getInsertSuffix ($ name )}
26552655 " );
26562656
26572657 foreach ($ bindValues as $ key => $ value ) {
@@ -2661,7 +2661,7 @@ public function createDocuments(Document $collection, array $documents, bool $ig
26612661 $ this ->execute ($ stmt );
26622662
26632663 // Reconcile returned docs with actual inserts when a race condition skipped rows.
2664- if ($ ignore && $ stmt ->rowCount () < \count ($ documents )) {
2664+ if ($ this -> skipDuplicates && $ stmt ->rowCount () < \count ($ documents )) {
26652665 $ expectedTimestamps = [];
26662666 foreach ($ documents as $ doc ) {
26672667 $ eKey = ($ this ->sharedTables && $ this ->tenantPerDocument )
@@ -2762,9 +2762,9 @@ public function createDocuments(Document $collection, array $documents, bool $ig
27622762 $ permissions = \implode (', ' , $ permissions );
27632763
27642764 $ sqlPermissions = "
2765- {$ this ->getInsertKeyword ($ ignore )} {$ this ->getSQLTable ($ name . '_perms ' )} (_type, _permission, _document {$ tenantColumn })
2765+ {$ this ->getInsertKeyword ()} {$ this ->getSQLTable ($ name . '_perms ' )} (_type, _permission, _document {$ tenantColumn })
27662766 VALUES {$ permissions }
2767- {$ this ->getInsertPermissionsSuffix ($ ignore )}
2767+ {$ this ->getInsertPermissionsSuffix ()}
27682768 " ;
27692769
27702770 $ stmtPermissions = $ this ->getPDO ()->prepare ($ sqlPermissions );
@@ -2787,16 +2787,16 @@ public function createDocuments(Document $collection, array $documents, bool $ig
27872787 * Returns the INSERT keyword, optionally with IGNORE for duplicate handling.
27882788 * Override in adapter subclasses for DB-specific syntax.
27892789 */
2790- protected function getInsertKeyword (bool $ ignore ): string
2790+ protected function getInsertKeyword (): string
27912791 {
2792- return $ ignore ? 'INSERT IGNORE INTO ' : 'INSERT INTO ' ;
2792+ return $ this -> skipDuplicates ? 'INSERT IGNORE INTO ' : 'INSERT INTO ' ;
27932793 }
27942794
27952795 /**
27962796 * Returns a suffix appended after VALUES clause for duplicate handling.
27972797 * Override in adapter subclasses (e.g., Postgres uses ON CONFLICT DO NOTHING).
27982798 */
2799- protected function getInsertSuffix (bool $ ignore , string $ table ): string
2799+ protected function getInsertSuffix (string $ table ): string
28002800 {
28012801 return '' ;
28022802 }
@@ -2805,7 +2805,7 @@ protected function getInsertSuffix(bool $ignore, string $table): string
28052805 * Returns a suffix for the permissions INSERT statement when ignoring duplicates.
28062806 * Override in adapter subclasses for DB-specific syntax.
28072807 */
2808- protected function getInsertPermissionsSuffix (bool $ ignore ): string
2808+ protected function getInsertPermissionsSuffix (): string
28092809 {
28102810 return '' ;
28112811 }
0 commit comments