本文整理汇总了PHP中Drupal\Core\Entity\EntityTypeInterface::getStorageClass方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityTypeInterface::getStorageClass方法的具体用法?PHP EntityTypeInterface::getStorageClass怎么用?PHP EntityTypeInterface::getStorageClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\EntityTypeInterface
的用法示例。
在下文中一共展示了EntityTypeInterface::getStorageClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requiresEntityDataMigration
/**
* {@inheritdoc}
*/
public function requiresEntityDataMigration(EntityTypeInterface $entity_type, EntityTypeInterface $original)
{
// If the original storage has existing entities, or it is impossible to
// determine if that is the case, require entity data to be migrated.
$original_storage_class = $original->getStorageClass();
if (!class_exists($original_storage_class)) {
return TRUE;
}
// Data migration is not needed when only indexes changed, as they can be
// applied if there is data.
if (!$this->hasSharedTableStructureChange($entity_type, $original)) {
return FALSE;
}
// Use the original entity type since the storage has not been updated.
$original_storage = $this->entityManager->createHandlerInstance($original_storage_class, $original);
return $original_storage->hasData();
}
示例2: requiresEntityDataMigration
/**
* {@inheritdoc}
*/
public function requiresEntityDataMigration(EntityTypeInterface $entity_type, EntityTypeInterface $original)
{
// If we're updating from NULL storage, then there's no stored data that
// requires migration.
// @todo Remove in https://www.drupal.org/node/2335879.
$original_storage_class = $original->getStorageClass();
$null_storage_class = 'Drupal\\Core\\Entity\\ContentEntityNullStorage';
if ($original_storage_class == $null_storage_class || is_subclass_of($original_storage_class, $null_storage_class)) {
return FALSE;
}
return $entity_type->getStorageClass() != $original_storage_class || !$this->isTableEmpty($this->storage->getBaseTable());
}