Skip to content

Commit 659e9f9

Browse files
committed
PHP-1336: Use Cursor->getId(), not Cursor->getCursorId()
1 parent e24d699 commit 659e9f9

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

src/MongoDB/Cursor.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ PHP_METHOD(Cursor, getId)
8383
}
8484
zend_restore_error_handling(&error_handling TSRMLS_CC);
8585

86+
php_phongo_cursor_id_new_from_id(return_value, mongoc_cursor_get_id(intern->cursor) TSRMLS_CC);
8687
}
8788
/* }}} */
8889
/* {{{ proto MongoDB\Server Cursor::getServer()
@@ -147,25 +148,6 @@ PHP_METHOD(Cursor, kill)
147148
//mongoc_client_kill_cursor(php_phongo_client_from_hint(hint), mongoc_cursor_get_id(intern->cursor));
148149
}
149150
/* }}} */
150-
/* {{{ proto boolean Cursor::getCursorId()
151-
Gets a batch size for the cursor */
152-
PHP_METHOD(Cursor, getCursorId)
153-
{
154-
php_phongo_cursor_t *intern;
155-
zend_error_handling error_handling;
156-
157-
158-
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
159-
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
160-
161-
if (zend_parse_parameters_none() == FAILURE) {
162-
zend_restore_error_handling(&error_handling TSRMLS_CC);
163-
return;
164-
}
165-
zend_restore_error_handling(&error_handling TSRMLS_CC);
166-
php_phongo_cursor_id_new_from_id(return_value, mongoc_cursor_get_id(intern->cursor) TSRMLS_CC);
167-
}
168-
/* }}} */
169151
/* {{{ proto boolean Cursor::setBatchSize(integer $batchSize)
170152
Sets a batch size for the cursor */
171153
PHP_METHOD(Cursor, setBatchSize)
@@ -335,9 +317,6 @@ ZEND_END_ARG_INFO();
335317
ZEND_BEGIN_ARG_INFO_EX(ai_Cursor_kill, 0, 0, 0)
336318
ZEND_END_ARG_INFO();
337319

338-
ZEND_BEGIN_ARG_INFO_EX(ai_Cursor_getCursorId, 0, 0, 0)
339-
ZEND_END_ARG_INFO();
340-
341320
ZEND_BEGIN_ARG_INFO_EX(ai_Cursor_getBatchSize, 0, 0, 0)
342321
ZEND_END_ARG_INFO();
343322

@@ -367,7 +346,6 @@ static zend_function_entry php_phongo_cursor_me[] = {
367346
PHP_ME(Cursor, getServer, ai_Cursor_getServer, ZEND_ACC_PUBLIC)
368347
PHP_ME(Cursor, isDead, ai_Cursor_isDead, ZEND_ACC_PUBLIC)
369348
PHP_ME(Cursor, kill, ai_Cursor_kill, ZEND_ACC_PUBLIC)
370-
PHP_ME(Cursor, getCursorId, ai_Cursor_getCursorId, ZEND_ACC_PUBLIC)
371349
PHP_ME(Cursor, getBatchSize, ai_Cursor_getBatchSize, ZEND_ACC_PUBLIC)
372350
PHP_ME(Cursor, setBatchSize, ai_Cursor_setBatchSize, ZEND_ACC_PUBLIC)
373351
PHP_ME(Cursor, current, ai_Cursor_current, ZEND_ACC_PUBLIC)

tests/functional/cursorid-001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $query = new MongoDB\Query(array(), array(
1818

1919
$qr = $manager->executeQuery(NS, $query);
2020
$cursor = $qr->getIterator();
21-
$cursorid = $cursor->getCursorId();
21+
$cursorid = $cursor->getId();
2222
$s1 = (string)$cursorid;
2323
var_dump(
2424
$cursorid,

0 commit comments

Comments
 (0)