本文整理匯總了PHP中Drupal\Core\Database\Query\SelectInterface::addTag方法的典型用法代碼示例。如果您正苦於以下問題:PHP SelectInterface::addTag方法的具體用法?PHP SelectInterface::addTag怎麽用?PHP SelectInterface::addTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\Core\Database\Query\SelectInterface
的用法示例。
在下文中一共展示了SelectInterface::addTag方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepareQuery
/**
* A helper for adding tags and metadata to the query.
*
* @return \Drupal\Core\Database\Query\SelectInterface
* The query with additional tags and metadata.
*/
protected function prepareQuery()
{
$this->query = clone $this->query();
$this->query->addTag('migrate');
$this->query->addTag('migrate_' . $this->migration->id());
$this->query->addMetaData('migration', $this->migration);
return $this->query;
}
示例2: prepare
/**
* Prepares the basic query with proper metadata/tags and base fields.
*
* @throws \Drupal\Core\Entity\Query\QueryException
* Thrown if the base table does not exists.
*
* @return \Drupal\Core\Entity\Query\Sql\Query
* Returns the called object.
*/
protected function prepare()
{
if ($this->allRevisions) {
if (!($base_table = $this->entityType->getRevisionTable())) {
throw new QueryException("No revision table for " . $this->entityTypeId . ", invalid query.");
}
} else {
if (!($base_table = $this->entityType->getBaseTable())) {
throw new QueryException("No base table for " . $this->entityTypeId . ", invalid query.");
}
}
$simple_query = TRUE;
if ($this->entityType->getDataTable()) {
$simple_query = FALSE;
}
$this->sqlQuery = $this->connection->select($base_table, 'base_table', array('conjunction' => $this->conjunction));
$this->sqlQuery->addMetaData('entity_type', $this->entityTypeId);
$id_field = $this->entityType->getKey('id');
// Add the key field for fetchAllKeyed().
if (!($revision_field = $this->entityType->getKey('revision'))) {
// When there is no revision support, the key field is the entity key.
$this->sqlFields["base_table.{$id_field}"] = array('base_table', $id_field);
// Now add the value column for fetchAllKeyed(). This is always the
// entity id.
$this->sqlFields["base_table.{$id_field}" . '_1'] = array('base_table', $id_field);
} else {
// When there is revision support, the key field is the revision key.
$this->sqlFields["base_table.{$revision_field}"] = array('base_table', $revision_field);
// Now add the value column for fetchAllKeyed(). This is always the
// entity id.
$this->sqlFields["base_table.{$id_field}"] = array('base_table', $id_field);
}
if ($this->accessCheck) {
$this->sqlQuery->addTag($this->entityTypeId . '_access');
}
$this->sqlQuery->addTag('entity_query');
$this->sqlQuery->addTag('entity_query_' . $this->entityTypeId);
// Add further tags added.
if (isset($this->alterTags)) {
foreach ($this->alterTags as $tag => $value) {
$this->sqlQuery->addTag($tag);
}
}
// Add further metadata added.
if (isset($this->alterMetaData)) {
foreach ($this->alterMetaData as $key => $value) {
$this->sqlQuery->addMetaData($key, $value);
}
}
// This now contains first the table containing entity properties and
// last the entity base table. They might be the same.
$this->sqlQuery->addMetaData('all_revisions', $this->allRevisions);
$this->sqlQuery->addMetaData('simple_query', $simple_query);
return $this;
}
示例3: addTag
public function addTag($tag)
{
$this->query->addTag($tag);
return $this;
}