function StatementInterface::setFetchMode

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

Sets the default fetch mode for this statement.

Parameters

\Drupal\Core\Database\Statement\FetchAs $mode: One of the cases of the FetchAs enum.

string|int|null $a1: (Optional) An option depending of the fetch mode specified by $mode:

  • for FetchAs::Column, the index of the column to fetch;
  • for FetchAs::ClassObject, the name of the class to create.

list<mixed> $a2: (Optional) If $mode is FetchAs::ClassObject, the optional arguments to pass to the constructor.

Return value

bool TRUE if successful, FALSE if not.

1 method overrides StatementInterface::setFetchMode()
StatementBase::setFetchMode in core/lib/Drupal/Core/Database/Statement/StatementBase.php

File

core/lib/Drupal/Core/Database/StatementInterface.php, line 83

Class

StatementInterface
Represents a prepared statement.

Namespace

Drupal\Core\Database

Code

public function setFetchMode(FetchAs $mode, string|int|null $a1 = NULL, array $a2 = []);

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