function StatementIteratorTrait::valid

Same name in other branches
  1. 10 core/lib/Drupal/Core/Database/StatementIteratorTrait.php \Drupal\Core\Database\StatementIteratorTrait::valid()

Checks if current position is valid.

This method is called after ::rewind() and ::next() to check if the current position is valid.

@internal This method should not be called directly.

See also

https://www.php.net/manual/en/iterator.valid.php

File

core/lib/Drupal/Core/Database/StatementIteratorTrait.php, line 137

Class

StatementIteratorTrait
StatementInterface iterator trait.

Namespace

Drupal\Core\Database

Code

public function valid() : bool {
    if ($this->isResultsetIterable && $this->resultsetKey === -1) {
        $this->fetch();
    }
    return $this->isResultsetIterable;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.