當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityStorageInterface::getEntityType方法代碼示例

本文整理匯總了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();
 }
開發者ID:DrupalCamp-NYC,項目名稱:dcnyc16,代碼行數:16,代碼來源:EntityContentBaseTest.php

示例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, []));
 }
開發者ID:aWEBoLabs,項目名稱:taxi,代碼行數:18,代碼來源:EntityRevisionTest.php

示例3: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     static::invalidateTagsOnDelete($storage->getEntityType(), $entities);
 }
開發者ID:jeyram,項目名稱:camp-gdl,代碼行數:7,代碼來源:Entity.php

示例4: calculateDependencies

 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     $this->addDependency('module', $this->storage->getEntityType()->getProvider());
     return $this->dependencies;
 }
開發者ID:nsp15,項目名稱:Drupal8,代碼行數:8,代碼來源:Entity.php

示例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);
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:15,代碼來源:Entity.php

示例6: sortSearchPages

 /**
  * {@inheritdoc}
  */
 public function sortSearchPages($search_pages)
 {
     $entity_type = $this->storage->getEntityType();
     uasort($search_pages, array($entity_type->getClass(), 'sort'));
     return $search_pages;
 }
開發者ID:davidsoloman,項目名稱:drupalconsole.com,代碼行數:9,代碼來源:SearchPageRepository.php


注:本文中的Drupal\Core\Entity\EntityStorageInterface::getEntityType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。