function Update::getQueryArguments
Returns the query arguments with placeholders mapped to their values.
Return value
array An array containing arguments and update values. Both arguments and update values are associative array where the keys are the placeholder names and the values are the placeholder values.
3 calls to Update::getQueryArguments()
- Update::arguments in core/
lib/ Drupal/ Core/ Database/ Query/ Update.php - Gets a complete list of all values to insert into the prepared statement.
- Update::execute in core/
lib/ Drupal/ Core/ Database/ Query/ Update.php - Executes the UPDATE query.
- Update::__toString in core/
lib/ Drupal/ Core/ Database/ Query/ Update.php - Implements PHP magic __toString method to convert the query to a string.
File
-
core/
lib/ Drupal/ Core/ Database/ Query/ Update.php, line 196
Class
- Update
- General class for an abstracted UPDATE operation.
Namespace
Drupal\Core\Database\QueryCode
protected function getQueryArguments() : array {
// Expressions take priority over literal fields, so we process those first
// and remove any literal fields that conflict.
$fields = $this->fields;
$update_values = [];
foreach ($this->expressionFields as $field => $data) {
if (!empty($data['arguments'])) {
$update_values += $data['arguments'];
}
if ($data['expression'] instanceof SelectInterface) {
$data['expression']->compile($this->connection, $this);
$update_values += $data['expression']->arguments();
}
unset($fields[$field]);
}
// Because we filter $fields the same way here and in __toString(), the
// placeholders will all match up properly.
$max_placeholder = 0;
$args = [];
foreach ($fields as $value) {
$args[':db_update_placeholder_' . $max_placeholder++] = $value;
}
return [
$args,
$update_values,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.