@@ -140,7 +140,6 @@ PHP_METHOD(Manager, executeWriteBatch)
140
140
zval * zbatch ;
141
141
zval * zwrite_concern = NULL ;
142
142
php_phongo_writebatch_t * batch ;
143
- php_phongo_writeconcern_t * write_concern ;
144
143
145
144
146
145
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
@@ -154,8 +153,7 @@ PHP_METHOD(Manager, executeWriteBatch)
154
153
155
154
156
155
batch = (php_phongo_writebatch_t * )zend_object_store_get_object (zbatch TSRMLS_CC );
157
- write_concern = (php_phongo_writeconcern_t * )zend_object_store_get_object (zwrite_concern TSRMLS_CC );
158
- phongo_execute_write (intern -> client , namespace , batch -> batch , write_concern -> write_concern , 0 , return_value , return_value_used TSRMLS_CC );
156
+ phongo_execute_write (intern -> client , namespace , batch -> batch , phongo_write_concern_from_zval (zwrite_concern TSRMLS_CC ), 0 , return_value , return_value_used TSRMLS_CC );
159
157
}
160
158
/* }}} */
161
159
/* {{{ proto MongoDB\WriteResult Manager::executeInsert(string $namespace, array|object $document[, MongoDB\WriteConcern $writeConcern = null])
@@ -169,7 +167,6 @@ PHP_METHOD(Manager, executeInsert)
169
167
zval * document ;
170
168
zval * zwrite_concern = NULL ;
171
169
bson_t * bson ;
172
- php_phongo_writeconcern_t * write_concern ;
173
170
174
171
175
172
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
@@ -182,10 +179,9 @@ PHP_METHOD(Manager, executeInsert)
182
179
zend_restore_error_handling (& error_handling TSRMLS_CC );
183
180
184
181
185
- write_concern = (php_phongo_writeconcern_t * )zend_object_store_get_object (zwrite_concern TSRMLS_CC );
186
182
bson = bson_new ();
187
183
zval_to_bson (document , PHONGO_BSON_NONE , bson , NULL TSRMLS_CC );
188
- phongo_execute_single_insert (intern -> client , namespace , bson , write_concern -> write_concern , return_value , return_value_used TSRMLS_CC );
184
+ phongo_execute_single_insert (intern -> client , namespace , bson , phongo_write_concern_from_zval ( zwrite_concern TSRMLS_CC ) , return_value , return_value_used TSRMLS_CC );
189
185
bson_clear (& bson );
190
186
}
191
187
/* }}} */
@@ -204,7 +200,6 @@ PHP_METHOD(Manager, executeUpdate)
204
200
bson_t * query ;
205
201
bson_t * update ;
206
202
mongoc_update_flags_t flags = MONGOC_UPDATE_NONE ;
207
- php_phongo_writeconcern_t * write_concern ;
208
203
209
204
210
205
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
@@ -217,7 +212,6 @@ PHP_METHOD(Manager, executeUpdate)
217
212
zend_restore_error_handling (& error_handling TSRMLS_CC );
218
213
219
214
220
- write_concern = (php_phongo_writeconcern_t * )zend_object_store_get_object (zwrite_concern TSRMLS_CC );
221
215
query = bson_new ();
222
216
update = bson_new ();
223
217
zval_to_bson (zquery , PHONGO_BSON_NONE , query , NULL TSRMLS_CC );
@@ -230,7 +224,7 @@ PHP_METHOD(Manager, executeUpdate)
230
224
flags |= MONGOC_UPDATE_MULTI_UPDATE ;
231
225
}
232
226
233
- phongo_execute_single_update (intern -> client , namespace , query , update , write_concern -> write_concern , flags , return_value , return_value_used TSRMLS_CC );
227
+ phongo_execute_single_update (intern -> client , namespace , query , update , phongo_write_concern_from_zval ( zwrite_concern TSRMLS_CC ) , flags , return_value , return_value_used TSRMLS_CC );
234
228
bson_clear (& query );
235
229
bson_clear (& update );
236
230
}
@@ -248,7 +242,6 @@ PHP_METHOD(Manager, executeDelete)
248
242
zval * zwrite_concern = NULL ;
249
243
bson_t * bson ;
250
244
mongoc_delete_flags_t flags = MONGOC_DELETE_NONE ;
251
- php_phongo_writeconcern_t * write_concern ;
252
245
253
246
254
247
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
@@ -261,13 +254,12 @@ PHP_METHOD(Manager, executeDelete)
261
254
zend_restore_error_handling (& error_handling TSRMLS_CC );
262
255
263
256
264
- write_concern = (php_phongo_writeconcern_t * )zend_object_store_get_object (zwrite_concern TSRMLS_CC );
265
257
if (deleteOptions && php_array_fetch_bool (deleteOptions , "limit" )) {
266
258
flags |= MONGOC_DELETE_SINGLE_REMOVE ;
267
259
}
268
260
bson = bson_new ();
269
261
zval_to_bson (query , PHONGO_BSON_NONE , bson , NULL TSRMLS_CC );
270
- phongo_execute_single_delete (intern -> client , namespace , bson , write_concern -> write_concern , flags , return_value , return_value_used TSRMLS_CC );
262
+ phongo_execute_single_delete (intern -> client , namespace , bson , phongo_write_concern_from_zval ( zwrite_concern TSRMLS_CC ) , flags , return_value , return_value_used TSRMLS_CC );
271
263
bson_clear (& bson );
272
264
}
273
265
/* }}} */
0 commit comments