@@ -180,28 +180,33 @@ PHP_METHOD(Manager, executeBulkWrite)
180
180
phongo_execute_write (intern -> client , namespace , bulk -> bulk , phongo_write_concern_from_zval (zwrite_concern TSRMLS_CC ), -1 , return_value , return_value_used TSRMLS_CC );
181
181
}
182
182
/* }}} */
183
- /* {{{ proto MongoDB\Driver\WriteResult Manager::executeInsert(string $namespace, array|object $document[, MongoDB\Driver\WriteConcern $writeConcern = null])
183
+ /* {{{ proto MongoDB\Driver\WriteResult Manager::executeInsert(string $namespace, array|object $document[, array $insertOptions = array()[, MongoDB\Driver\WriteConcern $writeConcern = null] ])
184
184
Convenience method for single insert operation. */
185
185
PHP_METHOD (Manager , executeInsert )
186
186
{
187
187
php_phongo_manager_t * intern ;
188
188
char * namespace ;
189
189
int namespace_len ;
190
190
zval * document ;
191
+ zval * insertOptions = NULL ;
191
192
zval * zwrite_concern = NULL ;
192
193
bson_t * bson ;
193
194
(void )return_value_ptr ;
194
195
195
196
196
197
intern = (php_phongo_manager_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
197
198
198
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sA|O!" , & namespace , & namespace_len , & document , & zwrite_concern , php_phongo_writeconcern_ce ) == FAILURE ) {
199
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sA|a! O!" , & namespace , & namespace_len , & document , & insertOptions , & zwrite_concern , php_phongo_writeconcern_ce ) == FAILURE ) {
199
200
return ;
200
201
}
201
202
202
203
203
204
bson = bson_new ();
204
205
zval_to_bson (document , PHONGO_BSON_ADD_ODS |PHONGO_BSON_ADD_CHILD_ODS , bson , NULL TSRMLS_CC );
206
+
207
+ /* When PHPC-443 is implemented, insertOptions will be parsed for the
208
+ * bypassDocumentValidation option; however, there's nothing to do now. */
209
+
205
210
phongo_execute_single_insert (intern -> client , namespace , bson , phongo_write_concern_from_zval (zwrite_concern TSRMLS_CC ), -1 , return_value , return_value_used TSRMLS_CC );
206
211
bson_clear (& bson );
207
212
}
@@ -422,6 +427,7 @@ ZEND_END_ARG_INFO();
422
427
ZEND_BEGIN_ARG_INFO_EX (ai_Manager_executeInsert , 0 , 0 , 2 )
423
428
ZEND_ARG_INFO (0 , namespace )
424
429
ZEND_ARG_INFO (0 , document )
430
+ ZEND_ARG_ARRAY_INFO (0 , insertOptions , 1 )
425
431
ZEND_ARG_OBJ_INFO (0 , writeConcern , MongoDB \\Driver \\WriteConcern , 1 )
426
432
ZEND_END_ARG_INFO ();
427
433
0 commit comments