function StatementWrapperIterator::fetchObject

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

Overrides StatementInterface::fetchObject

File

core/lib/Drupal/Core/Database/StatementWrapperIterator.php, line 238

Class

StatementWrapperIterator
StatementInterface iterator implementation.

Namespace

Drupal\Core\Database

Code

public function fetchObject(?string $class_name = NULL, array $constructor_arguments = []) {
    if ($class_name) {
        $row = $this->clientStatement
            ->fetchObject($class_name, $constructor_arguments);
    }
    else {
        $row = $this->clientStatement
            ->fetchObject();
    }
    if ($row === FALSE) {
        $this->markResultsetFetchingComplete();
        return FALSE;
    }
    $this->setResultsetCurrentRow($row);
    return $row;
}

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