function StatementInterface::fetchObject

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/StatementInterface.php \Drupal\Core\Database\StatementInterface::fetchObject()
  2. 8.9.x core/lib/Drupal/Core/Database/StatementInterface.php \Drupal\Core\Database\StatementInterface::fetchObject()
  3. 11.x core/lib/Drupal/Core/Database/StatementInterface.php \Drupal\Core\Database\StatementInterface::fetchObject()

Fetches the next row and returns it as an object.

The object will be of the class specified by StatementInterface::setFetchMode() or stdClass if not specified.

phpcs:disable Drupal.Commenting @todo Uncomment new method parameters before drupal:11.0.0.

Parameters

string|null $class_name: Name of the created class.

array $constructor_arguments: Elements of this array are passed to the constructor. phpcs:enable

Return value

mixed The object of specified class or \stdClass if not specified. Returns FALSE or NULL if there is no next row.

See also

https://www.drupal.org/project/drupal/issues/3354672

4 methods override StatementInterface::fetchObject()
StatementPrefetch::fetchObject in core/lib/Drupal/Core/Database/StatementPrefetch.php
Fetches the next row and returns it as an object.
StatementPrefetchIterator::fetchObject in core/lib/Drupal/Core/Database/StatementPrefetchIterator.php
Fetches the next row and returns it as an object.
StatementWrapper::fetchObject in core/lib/Drupal/Core/Database/StatementWrapper.php
Fetches the next row and returns it as an object.
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/StatementInterface.php, line 134

Class

StatementInterface
Represents a prepared statement.

Namespace

Drupal\Core\Database

Code

public function fetchObject();

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