See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
Applies the same callback to all recorset records.
Copyright: | 2015 David Monllao |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 163 lines (4 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
recordset_walk:: (8 methods):
__construct()
__destruct()
current()
next()
key()
valid()
rewind()
close()
Class: recordset_walk - X-Ref
Iterator that walks through a moodle_recordset applying the provided function.__construct(\moodle_recordset $recordset, callable $callback, $callbackextra = null) X-Ref |
Create a new iterator applying the callback to each record. param: \moodle_recordset $recordset Recordset to iterate. param: callable $callback Apply this function to each record. If using a method, it should be public. param: mixed $callbackextra An extra single parameter to pass to the callback. Use a container to pass multiple values. |
__destruct() X-Ref |
Closes the recordset. return: void |
current() X-Ref |
Returns the current element after applying the callback. return: mixed|bool The returned value type will depend on the callback. |
next() X-Ref |
Moves the internal pointer to the next record. return: void |
key() X-Ref |
Returns current record key. return: int |
valid() X-Ref |
Returns whether the current position is valid or not. If we reached the end of the recordset we close as we don't allow rewinds. Doing do so we reduce the chance of unclosed recordsets. return: bool |
rewind() X-Ref |
Rewind is not supported. return: void |
close() X-Ref |
Closes the recordset. return: void |