Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Update.php

function Update::expression

Specifies fields to be updated as an expression.

Expression fields are cases such as counter=counter+1. This method takes precedence over fields().

Parameters

$field: The field to set.

$expression: The field will be set to the value of this expression. This parameter may include named placeholders.

$arguments: If specified, this is an array of key/value pairs for named placeholders corresponding to the expression.

Return value

$this The called object.

File

core/lib/Drupal/Core/Database/Query/Update.php, line 102

Class

Update
General class for an abstracted UPDATE operation.

Namespace

Drupal\Core\Database\Query

Code

public function expression($field, $expression, ?array $arguments = NULL) {
    $this->expressionFields[$field] = [
        'expression' => $expression,
        'arguments' => $arguments,
    ];
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal