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


PHP EntityTypeInterface::getClass方法代碼示例

本文整理匯總了PHP中Drupal\Core\Entity\EntityTypeInterface::getClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityTypeInterface::getClass方法的具體用法?PHP EntityTypeInterface::getClass怎麽用?PHP EntityTypeInterface::getClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Entity\EntityTypeInterface的用法示例。


在下文中一共展示了EntityTypeInterface::getClass方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructs an EntityStorageBase instance.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type definition.
  */
 public function __construct(EntityTypeInterface $entity_type)
 {
     $this->entityTypeId = $entity_type->id();
     $this->entityType = $entity_type;
     $this->idKey = $this->entityType->getKey('id');
     $this->uuidKey = $this->entityType->getKey('uuid');
     $this->entityClass = $this->entityType->getClass();
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:14,代碼來源:EntityStorageBase.php

示例2: setUpEntityWithFieldDefinition

 /**
  * Prepares an entity that defines a field definition.
  *
  * @param bool $custom_invoke_all
  *   (optional) Whether the test will set up its own
  *   ModuleHandlerInterface::invokeAll() implementation. Defaults to FALSE.
  * @param string $field_definition_id
  *   (optional) The ID to use for the field definition. Defaults to 'id'.
  * @param array $entity_keys
  *   (optional) An array of entity keys for the mocked entity type. Defaults
  *   to an empty array.
  *
  * @return \Drupal\Core\Field\BaseFieldDefinition|\Prophecy\Prophecy\ProphecyInterface
  *   A field definition object.
  */
 protected function setUpEntityWithFieldDefinition($custom_invoke_all = FALSE, $field_definition_id = 'id', $entity_keys = array())
 {
     $field_type_manager = $this->prophesize(FieldTypePluginManagerInterface::class);
     $field_type_manager->getDefaultStorageSettings('boolean')->willReturn([]);
     $field_type_manager->getDefaultFieldSettings('boolean')->willReturn([]);
     $this->container->get('plugin.manager.field.field_type')->willReturn($field_type_manager->reveal());
     $string_translation = $this->prophesize(TranslationInterface::class);
     $this->container->get('string_translation')->willReturn($string_translation->reveal());
     $entity_class = EntityManagerTestEntity::class;
     $field_definition = $this->prophesize()->willImplement(FieldDefinitionInterface::class)->willImplement(FieldStorageDefinitionInterface::class);
     $entity_class::$baseFieldDefinitions = array($field_definition_id => $field_definition->reveal());
     $entity_class::$bundleFieldDefinitions = array();
     if (!$custom_invoke_all) {
         $this->moduleHandler->getImplementations(Argument::cetera())->willReturn([]);
     }
     // Mock the base field definition override.
     $override_entity_type = $this->prophesize(EntityTypeInterface::class);
     $this->entityType = $this->prophesize(EntityTypeInterface::class);
     $this->setUpEntityManager(array('test_entity_type' => $this->entityType, 'base_field_override' => $override_entity_type));
     $override_entity_type->getClass()->willReturn($entity_class);
     $override_entity_type->getHandlerClass('storage')->willReturn(TestConfigEntityStorage::class);
     $this->entityType->getClass()->willReturn($entity_class);
     $this->entityType->getKeys()->willReturn($entity_keys + ['default_langcode' => 'default_langcode']);
     $this->entityType->isSubclassOf(FieldableEntityInterface::class)->willReturn(TRUE);
     $this->entityType->isTranslatable()->willReturn(FALSE);
     $this->entityType->getProvider()->willReturn('the_provider');
     $this->entityType->id()->willReturn('the_entity_id');
     return $field_definition->reveal();
 }
開發者ID:HakS,項目名稱:drupal8_training,代碼行數:44,代碼來源:EntityManagerTest.php

示例3: definitionClassImplementsInterface

 /**
  * Determines if the class for an entity type definition implements and interface.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $type
  * @param array $interfaces
  *
  * @return bool
  */
 protected function definitionClassImplementsInterface(EntityTypeInterface $type, array $interfaces) {
   return $this->implementsInterface($type->getClass(), $interfaces);
 }
開發者ID:joebachana,項目名稱:usatne,代碼行數:11,代碼來源:ClassUtilsTrait.php

示例4: hasChangedTime

 /**
  * Checks whether the entity type supports modification time natively.
  *
  * @return bool
  *   TRUE if metadata is natively supported, FALSE otherwise.
  */
 protected function hasChangedTime()
 {
     return is_subclass_of($this->entityType->getClass(), '\\Drupal\\Core\\Entity\\EntityChangedInterface');
 }
開發者ID:brstde,項目名稱:gap1,代碼行數:10,代碼來源:ContentTranslationHandler.php


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