note 126401 added to class.mongodb-driver-cursor
| From: | cg.papoo.de via php-notes | Date: | Wed, 08 Sep 2021 16:29:25 +0000 |
| Subject: | note 126401 added to class.mongodb-driver-cursor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216930@lists.php.net to get a copy of this message | ||
Since php-mongodb version 1.9.0 Cursor implements Iterator, but if you need to support older
versions too, you can conditionally wrap the cursor with IteratorIterator:
<?php
$iterator = $collection->find();
if (!($iterator implements Iterator)) {
$iterator = new \IteratorIterator($iterator);
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 79.249.152.81)
----
Manual Page -- https://php.net/manual/en/class.mongodb-driver-cursor.php
Edit -- https://main.php.net/note/edit/126401
Del: integrated -- https://main.php.net/note/delete/126401/integrated
Del: useless -- https://main.php.net/note/delete/126401/useless
Del: bad code -- https://main.php.net/note/delete/126401/bad+code
Del: spam -- https://main.php.net/note/delete/126401/spam
Del: non-english -- https://main.php.net/note/delete/126401/non-english
Del: in docs -- https://main.php.net/note/delete/126401/in+docs
Del: other reasons-- https://main.php.net/note/delete/126401
Reject -- https://main.php.net/note/reject/126401
Search -- https://main.php.net/manage/user-notes.php