function PdoTrait::clientFetchObject

Fetches the next row and returns it as an object.

Parameters

class-string|null $class: FQCN of the class to be instantiated.

list<mixed>|null $constructorArguments: The arguments to be passed to the constructor.

Return value

object|false An instance of the required class with property names that correspond to the column names, or FALSE on failure.

1 call to PdoTrait::clientFetchObject()
StatementWrapperIterator::fetchObject in core/lib/Drupal/Core/Database/StatementWrapperIterator.php
Fetches the next row and returns it as an object.

File

core/lib/Drupal/Core/Database/Statement/PdoTrait.php, line 168

Class

PdoTrait
A trait for calling \PDOStatement methods.

Namespace

Drupal\Core\Database\Statement

Code

protected function clientFetchObject(?string $class = NULL, array $constructorArguments = []) : object|false {
    if ($class) {
        return $this->getClientStatement()
            ->fetchObject($class, $constructorArguments);
    }
    return $this->getClientStatement()
        ->fetchObject();
}

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