function StatementIteratorTrait::rewind
Same name in other branches
- 10 core/lib/Drupal/Core/Database/StatementIteratorTrait.php \Drupal\Core\Database\StatementIteratorTrait::rewind()
Rewinds back to the first element of the Iterator.
This is the first method called when starting a foreach loop. It will not be executed after foreach loops.
@internal This method should not be called directly.
See also
https://www.php.net/manual/en/iterator.rewind.php
File
-
core/
lib/ Drupal/ Core/ Database/ StatementIteratorTrait.php, line 105
Class
- StatementIteratorTrait
- StatementInterface iterator trait.
Namespace
Drupal\Core\DatabaseCode
public function rewind() : void {
// Nothing to do: our DatabaseStatement can't be rewound. Error out when
// attempted.
if ($this->resultsetKey >= 0) {
$this->markResultsetIterable(FALSE);
throw new DatabaseExceptionWrapper('Attempted rewinding a StatementInterface object when fetching has already started. Refactor your code to avoid rewinding statement objects.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.