function AlterableInterface::addMetaData

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Query/AlterableInterface.php \Drupal\Core\Database\Query\AlterableInterface::addMetaData()
  2. 10 core/lib/Drupal/Core/Database/Query/AlterableInterface.php \Drupal\Core\Database\Query\AlterableInterface::addMetaData()
  3. 11.x core/lib/Drupal/Core/Database/Query/AlterableInterface.php \Drupal\Core\Database\Query\AlterableInterface::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.

3 methods override AlterableInterface::addMetaData()
QueryBase::addMetaData in core/lib/Drupal/Core/Entity/Query/QueryBase.php
Adds additional metadata to the query.
Select::addMetaData in core/lib/Drupal/Core/Database/Query/Select.php
Adds additional metadata to the query.
SelectExtender::addMetaData in core/lib/Drupal/Core/Database/Query/SelectExtender.php
Adds additional metadata to the query.

File

core/lib/Drupal/Core/Database/Query/AlterableInterface.php, line 82

Class

AlterableInterface
Interface for a query that can be manipulated via an alter hook.

Namespace

Drupal\Core\Database\Query

Code

public function addMetaData($key, $object);

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