当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityManagerInterface::onEntityTypeCreate方法代码示例

本文整理汇总了PHP中Drupal\Core\Entity\EntityManagerInterface::onEntityTypeCreate方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManagerInterface::onEntityTypeCreate方法的具体用法?PHP EntityManagerInterface::onEntityTypeCreate怎么用?PHP EntityManagerInterface::onEntityTypeCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Entity\EntityManagerInterface的用法示例。


在下文中一共展示了EntityManagerInterface::onEntityTypeCreate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(self::$modules);
     $this->installSchema('system', array('sequences'));
     $this->entityManager = \Drupal::entityManager();
     $this->entityManager->onEntityTypeCreate(\Drupal::entityManager()->getDefinition('user'));
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:11,代码来源:NameUserTest.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(self::$modules);
     $this->entityManager = \Drupal::entityManager();
     $this->entityManager->onEntityTypeCreate(\Drupal::entityManager()->getDefinition('entity_test'));
     $this->field = $this->createNameField('field_name_test', 'entity_test', 'entity_test');
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:11,代码来源:NameAutocompleteTest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(self::$modules);
     $this->entityManager = \Drupal::entityManager();
     $this->entityManager->onEntityTypeCreate(\Drupal::entityManager()->getDefinition('taxonomy_term'));
     $this->optionsProvider = \Drupal::service('name.options_provider');
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:8,代码来源:NameOptionsProviderTest.php

示例4: doEntityUpdate

 /**
  * Performs an entity type definition update.
  *
  * @param string $op
  *   The operation to perform, either static::DEFINITION_CREATED or
  *   static::DEFINITION_UPDATED.
  * @param string $entity_type_id
  *   The entity type ID.
  */
 protected function doEntityUpdate($op, $entity_type_id)
 {
     $entity_type = $this->entityManager->getDefinition($entity_type_id);
     switch ($op) {
         case static::DEFINITION_CREATED:
             $this->entityManager->onEntityTypeCreate($entity_type);
             break;
         case static::DEFINITION_UPDATED:
             $original = $this->entityManager->getLastInstalledDefinition($entity_type_id);
             $this->entityManager->onEntityTypeUpdate($entity_type, $original);
             break;
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:22,代码来源:EntityDefinitionUpdateManager.php

示例5: applyUpdates

 /**
  * {@inheritdoc}
  */
 public function applyUpdates()
 {
     $change_list = $this->getChangeList();
     if ($change_list) {
         // getChangeList() only disables the cache and does not invalidate.
         // In case there are changes, explicitly invalidate caches.
         $this->entityManager->clearCachedDefinitions();
     }
     foreach ($change_list as $entity_type_id => $change_list) {
         // Process entity type definition changes before storage definitions ones
         // this is necessary when you change an entity type from non-revisionable
         // to revisionable and at the same time add revisionable fields to the
         // entity type.
         if (!empty($change_list['entity_type'])) {
             $entity_type = $this->entityManager->getDefinition($entity_type_id);
             switch ($change_list['entity_type']) {
                 case static::DEFINITION_CREATED:
                     $this->entityManager->onEntityTypeCreate($entity_type);
                     break;
                 case static::DEFINITION_UPDATED:
                     $original = $this->entityManager->getLastInstalledDefinition($entity_type_id);
                     $this->entityManager->onEntityTypeUpdate($entity_type, $original);
                     break;
             }
         }
         // Process field storage definition changes.
         if (!empty($change_list['field_storage_definitions'])) {
             $storage_definitions = $this->entityManager->getFieldStorageDefinitions($entity_type_id);
             $original_storage_definitions = $this->entityManager->getLastInstalledFieldStorageDefinitions($entity_type_id);
             foreach ($change_list['field_storage_definitions'] as $field_name => $change) {
                 switch ($change) {
                     case static::DEFINITION_CREATED:
                         $this->entityManager->onFieldStorageDefinitionCreate($storage_definitions[$field_name]);
                         break;
                     case static::DEFINITION_UPDATED:
                         $this->entityManager->onFieldStorageDefinitionUpdate($storage_definitions[$field_name], $original_storage_definitions[$field_name]);
                         break;
                     case static::DEFINITION_DELETED:
                         $this->entityManager->onFieldStorageDefinitionDelete($original_storage_definitions[$field_name]);
                         break;
                 }
             }
         }
     }
 }
开发者ID:RealLukeMartin,项目名称:drupal8tester,代码行数:48,代码来源:EntityDefinitionUpdateManager.php

示例6: onEntityTypeCreate

 /**
  * {@inheritdoc}
  */
 public function onEntityTypeCreate(EntityTypeInterface $entity_type)
 {
     $this->entityManager->onEntityTypeCreate($entity_type);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:7,代码来源:EntityManagerWrapper.php


注:本文中的Drupal\Core\Entity\EntityManagerInterface::onEntityTypeCreate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。