@@ -180,28 +180,33 @@ PHP_METHOD(Manager, executeBulkWrite)
180180 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 );
181181}
182182/* }}} */
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] ])
184184 Convenience method for single insert operation. */
185185PHP_METHOD (Manager , executeInsert )
186186{
187187 php_phongo_manager_t * intern ;
188188 char * namespace ;
189189 int namespace_len ;
190190 zval * document ;
191+ zval * insertOptions = NULL ;
191192 zval * zwrite_concern = NULL ;
192193 bson_t * bson ;
193194 (void )return_value_ptr ;
194195
195196
196197 intern = (php_phongo_manager_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
197198
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 ) {
199200 return ;
200201 }
201202
202203
203204 bson = bson_new ();
204205 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+
205210 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 );
206211 bson_clear (& bson );
207212}
@@ -422,6 +427,7 @@ ZEND_END_ARG_INFO();
422427ZEND_BEGIN_ARG_INFO_EX (ai_Manager_executeInsert , 0 , 0 , 2 )
423428 ZEND_ARG_INFO (0 , namespace )
424429 ZEND_ARG_INFO (0 , document )
430+ ZEND_ARG_ARRAY_INFO (0 , insertOptions , 1 )
425431 ZEND_ARG_OBJ_INFO (0 , writeConcern , MongoDB \\Driver \\WriteConcern , 1 )
426432ZEND_END_ARG_INFO ();
427433
0 commit comments