本文整理匯總了PHP中Drupal\Core\Entity\EntityStorageInterface::getEntityType方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityStorageInterface::getEntityType方法的具體用法?PHP EntityStorageInterface::getEntityType怎麽用?PHP EntityStorageInterface::getEntityType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\Core\Entity\EntityStorageInterface
的用法示例。
在下文中一共展示了EntityStorageInterface::getEntityType方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testUntranslatable
/**
* Test that translation destination fails for untranslatable entities.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedExceptionMessage This entity type does not support translation
*/
public function testUntranslatable()
{
// An entity type without a language.
$entity_type = $this->prophesize(ContentEntityType::class);
$entity_type->getKey('langcode')->willReturn('');
$entity_type->getKey('id')->willReturn('id');
$this->storage->getEntityType()->willReturn($entity_type->reveal());
$destination = new EntityTestDestination(['translations' => TRUE], '', [], $this->migration->reveal(), $this->storage->reveal(), [], $this->entityManager->reveal(), $this->prophesize(FieldTypePluginManagerInterface::class)->reveal());
$destination->getIds();
}
示例2: testGetEntityLoadFailure
/**
* Test entity load failure.
*
* @covers ::getEntity
*/
public function testGetEntityLoadFailure()
{
$destination = $this->getEntityRevisionDestination([]);
$entity_type = $this->prophesize('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$entity_type->getKey('id')->willReturn('nid');
$entity_type->getKey('revision')->willReturn('vid');
$this->storage->getEntityType()->willReturn($entity_type->reveal());
// Return a failed load and make sure we don't fail and we return FALSE.
$this->storage->load(1)->shouldBeCalled()->willReturn(FALSE);
$row = new Row(['nid' => 1, 'vid' => 2], ['nid' => 1, 'vid' => 2]);
$row->setDestinationProperty('nid', 1);
$this->assertFalse($destination->getEntity($row, []));
}
示例3: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
static::invalidateTagsOnDelete($storage->getEntityType(), $entities);
}
示例4: calculateDependencies
/**
* {@inheritdoc}
*/
public function calculateDependencies()
{
$this->addDependency('module', $this->storage->getEntityType()->getProvider());
return $this->dependencies;
}
示例5: getKey
/**
* Returns a specific entity key.
*
* @param string $key
* The name of the entity key to return.
*
* @return string|bool
* The entity key, or FALSE if it does not exist.
*
* @see \Drupal\Core\Entity\EntityTypeInterface::getKeys()
*/
protected function getKey($key)
{
return $this->storage->getEntityType()->getKey($key);
}
示例6: sortSearchPages
/**
* {@inheritdoc}
*/
public function sortSearchPages($search_pages)
{
$entity_type = $this->storage->getEntityType();
uasort($search_pages, array($entity_type->getClass(), 'sort'));
return $search_pages;
}