本文整理汇总了PHP中Drupal\Core\Database\Query\SelectInterface::getMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectInterface::getMetaData方法的具体用法?PHP SelectInterface::getMetaData怎么用?PHP SelectInterface::getMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Database\Query\SelectInterface
的用法示例。
在下文中一共展示了SelectInterface::getMetaData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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];
}
示例2: addJoin
protected function addJoin($type, $table, $join_condition, $langcode)
{
$arguments = array();
if ($langcode) {
$entity_type_id = $this->sqlQuery->getMetaData('entity_type');
$entity_type = $this->entityManager->getDefinition($entity_type_id);
// Only the data table follows the entity language key, dedicated field
// tables have an hard-coded 'langcode' column.
$langcode_key = $entity_type->getDataTable() == $table ? $entity_type->getKey('langcode') : 'langcode';
$placeholder = ':langcode' . $this->sqlQuery->nextPlaceholder();
$join_condition .= ' AND %alias.' . $langcode_key . ' = ' . $placeholder;
$arguments[$placeholder] = $langcode;
}
return $this->sqlQuery->addJoin($type, $table, NULL, $join_condition, $arguments);
}
示例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])) {
$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];
}
示例4: isSimpleQuery
/**
* Returns whether the query requires GROUP BY and ORDER BY MIN/MAX.
*
* @return bool
*/
protected function isSimpleQuery()
{
return !$this->pager && !$this->range && !$this->count || $this->sqlQuery->getMetaData('simple_query');
}
示例5: getMetaData
public function getMetaData($key)
{
return $this->query->getMetaData($key);
}