You are here

public function SelectExtender::addMetaData in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Database/Query/SelectExtender.php \Drupal\Core\Database\Query\SelectExtender::addMetaData()
  2. 9 core/lib/Drupal/Core/Database/Query/SelectExtender.php \Drupal\Core\Database\Query\SelectExtender::addMetaData()

Adds additional metadata to the query.

Often, a query may need to provide additional contextual data to alter hooks. Alter hooks may then use that information to decide if and how to take action.

Parameters

$key: The unique identifier for this piece of metadata. Must be a string that follows the same rules as any other PHP identifier.

$object: The additional data to add to the query. May be any valid PHP variable.

Return value

$this The called object.

Overrides AlterableInterface::addMetaData

1 call to SelectExtender::addMetaData()
SearchQuery::execute in core/modules/search/src/SearchQuery.php
Executes the search.

File

core/lib/Drupal/Core/Database/Query/SelectExtender.php, line 92

Class

SelectExtender
The base extender class for Select queries.

Namespace

Drupal\Core\Database\Query

Code

public function addMetaData($key, $object) {
  $this->query
    ->addMetaData($key, $object);
  return $this;
}