本文整理汇总了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;
}