当前位置: 首页>>代码示例>>PHP>>正文


PHP SelectInterface::addMetaData方法代码示例

本文整理汇总了PHP中Drupal\Core\Database\Query\SelectInterface::addMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectInterface::addMetaData方法的具体用法?PHP SelectInterface::addMetaData怎么用?PHP SelectInterface::addMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Database\Query\SelectInterface的用法示例。


在下文中一共展示了SelectInterface::addMetaData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:14,代码来源:SqlBase.php

示例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;
 }
开发者ID:Jessy-dupin,项目名称:alexandrie,代码行数:64,代码来源:Query.php

示例3: ensureFieldTable

 /**
  * Join field table if necessary.
  *
  * @param $field_name
  *   Name of the field.
  * @return string
  * @throws \Drupal\Core\Entity\Query\QueryException
  */
 protected function ensureFieldTable($index_prefix, &$field, $type, $langcode, $base_table, $entity_id_field, $field_id_field)
 {
     $field_name = $field->getName();
     if (!isset($this->fieldTables[$index_prefix . $field_name])) {
         $table = $this->sqlQuery->getMetaData('age') == EntityStorageInterface::FIELD_LOAD_CURRENT ? ContentEntityDatabaseStorage::_fieldTableName($field) : ContentEntityDatabaseStorage::_fieldRevisionTableName($field);
         if ($field->getCardinality() != 1) {
             $this->sqlQuery->addMetaData('simple_query', FALSE);
         }
         $entity_type = $this->sqlQuery->getMetaData('entity_type');
         $this->fieldTables[$index_prefix . $field_name] = $this->addJoin($type, $table, "%alias.{$field_id_field} = {$base_table}.{$entity_id_field}", $langcode);
     }
     return $this->fieldTables[$index_prefix . $field_name];
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:21,代码来源:Tables.php

示例4: ensureFieldTable

 /**
  * Join field table if necessary.
  *
  * @param $field_name
  *   Name of the field.
  * @return string
  * @throws \Drupal\Core\Entity\Query\QueryException
  */
 protected function ensureFieldTable($index_prefix, &$field, $type, $langcode, $base_table, $entity_id_field, $field_id_field)
 {
     $field_name = $field->getName();
     if (!isset($this->fieldTables[$index_prefix . $field_name])) {
         $entity_type_id = $this->sqlQuery->getMetaData('entity_type');
         /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
         $table_mapping = $this->entityManager->getStorage($entity_type_id)->getTableMapping();
         $table = $this->sqlQuery->getMetaData('age') == EntityStorageInterface::FIELD_LOAD_CURRENT ? $table_mapping->getDedicatedDataTableName($field) : $table_mapping->getDedicatedRevisionTableName($field);
         if ($field->getCardinality() != 1) {
             $this->sqlQuery->addMetaData('simple_query', FALSE);
         }
         $this->fieldTables[$index_prefix . $field_name] = $this->addJoin($type, $table, "%alias.{$field_id_field} = {$base_table}.{$entity_id_field}", $langcode);
     }
     return $this->fieldTables[$index_prefix . $field_name];
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:23,代码来源:Tables.php

示例5: addMetaData

 public function addMetaData($key, $object)
 {
     $this->query->addMetaData($key, $object);
     return $this;
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:5,代码来源:SelectExtender.php


注:本文中的Drupal\Core\Database\Query\SelectInterface::addMetaData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。