class Expression

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Database/Expression.php \Drupal\Core\Database\Expression

A value object representing an expression with its arguments.

Hierarchy

Expanded class hierarchy of Expression

1 file declares its use of Expression
UpsertUpdateExpression.php in core/lib/Drupal/Core/Database/Query/UpsertUpdateExpression.php
3 string references to 'Expression'
Select::addExpression in core/modules/pgsql/src/Driver/Database/pgsql/Select.php
Adds an expression to the list of "fields" to be SELECTed.
Select::addExpression in core/lib/Drupal/Core/Database/Query/Select.php
Adds an expression to the list of "fields" to be SELECTed.
SelectTest::testSimpleSelectExpressionMultiple in core/tests/Drupal/KernelTests/Core/Database/SelectTest.php
Tests SELECT statements with multiple expressions.

File

core/lib/Drupal/Core/Database/Expression.php, line 8

Namespace

Drupal\Core\Database
View source
class Expression {
  
  /**
   * Constructor.
   *
   * @param string $expression
   *   The expression text. Never include user input in the expression text;
   *   pass it through $arguments placeholders instead.
   * @param array<string,string|int|float|bool> $arguments
   *   (optional) The expression arguments, keyed by placeholder name.
   */
  public function __construct(public readonly string $expression, public readonly array $arguments = []) {
  }

}

Members

Title Sort descending Modifiers Object type Summary
Expression::__construct public function Constructor.

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