function StatementWrapperIterator::execute
Same name and namespace in other branches
- 10 core/lib/Drupal/Core/Database/StatementWrapperIterator.php \Drupal\Core\Database\StatementWrapperIterator::execute()
Overrides StatementBase::execute
File
-
core/
lib/ Drupal/ Core/ Database/ StatementWrapperIterator.php, line 72
Class
- StatementWrapperIterator
- StatementInterface iterator implementation.
Namespace
Drupal\Core\DatabaseCode
public function execute($args = [], $options = []) {
if (isset($options['fetch']) && is_int($options['fetch'])) {
@trigger_error("Passing the 'fetch' key as an integer to \$options in execute() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use a case of \\Drupal\\Core\\Database\\Statement\\FetchAs enum instead. See https://www.drupal.org/node/3488338", E_USER_DEPRECATED);
}
if (isset($options['fetch'])) {
if (is_string($options['fetch'])) {
$this->setFetchMode(FetchAs::ClassObject, $options['fetch']);
}
else {
$this->setFetchMode($options['fetch']);
}
}
$startEvent = $this->dispatchStatementExecutionStartEvent($args ?? []);
try {
$return = $this->clientExecute($args, $options);
$this->result = new PdoResult($this->fetchMode, $this->fetchOptions, $this->getClientStatement());
$this->markResultsetIterable($return);
} catch (\Exception $e) {
$this->dispatchStatementExecutionFailureEvent($startEvent, $e);
throw $e;
}
$this->dispatchStatementExecutionEndEvent($startEvent);
return $return;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.