本文整理匯總了PHP中Drupal\Core\Entity\EntityTypeInterface::getBaseTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityTypeInterface::getBaseTable方法的具體用法?PHP EntityTypeInterface::getBaseTable怎麽用?PHP EntityTypeInterface::getBaseTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\Core\Entity\EntityTypeInterface
的用法示例。
在下文中一共展示了EntityTypeInterface::getBaseTable方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
$this->entityTypeId = $this->definition['entity_type'];
$this->entityType = $this->entityManager->getDefinition($this->entityTypeId);
$this->base_table = $this->entityType->getDataTable() ?: $this->entityType->getBaseTable();
$this->base_field = $this->entityType->getKey('id');
}
示例2: hasSharedTableNameChanges
/**
* Detects whether any table name got renamed in an entity type update.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The new entity type.
* @param \Drupal\Core\Entity\EntityTypeInterface $original
* The origin entity type.
*
* @return bool
* Returns TRUE if there have been changes.
*/
protected function hasSharedTableNameChanges(EntityTypeInterface $entity_type, EntityTypeInterface $original)
{
return $entity_type->getBaseTable() != $original->getBaseTable() || $entity_type->getDataTable() != $original->getDataTable() || $entity_type->getRevisionTable() != $original->getRevisionTable() || $entity_type->getRevisionDataTable() != $original->getRevisionDataTable();
}
示例3: onEntityTypeDelete
/**
* {@inheritdoc}
*/
public function onEntityTypeDelete(EntityTypeInterface $entity_type)
{
$tables = [$entity_type->getBaseTable(), $entity_type->getDataTable(), $entity_type->getRevisionTable(), $entity_type->getRevisionDataTable()];
$all_views = $this->entityManager->getStorage('view')->loadMultiple(NULL);
/** @var \Drupal\views\Entity\View $view */
foreach ($all_views as $id => $view) {
// First check just the base table.
if (in_array($view->get('base_table'), $tables)) {
$view->disable();
$view->save();
}
}
}
示例4: testGetViewsDataWithEntityOperations
/**
* @covers ::getViewsData
*/
public function testGetViewsDataWithEntityOperations()
{
$this->baseEntityType->setListBuilderClass('\\Drupal\\Core\\Entity\\EntityListBuilder');
$data = $this->viewsData->getViewsData();
$this->assertSame('entity_operations', $data[$this->baseEntityType->getBaseTable()]['operations']['field']['id']);
}
示例5: getViewsTableForEntityType
/**
* Gets the table of an entity type to be used as base table in views.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return string
* The name of the base table in views.
*/
protected function getViewsTableForEntityType(EntityTypeInterface $entity_type)
{
return $entity_type->getDataTable() ?: $entity_type->getBaseTable();
}