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


PHP EntityManagerInterface::useCaches方法代码示例

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


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

示例1: getChangeList

 /**
  * Gets a list of changes to entity type and field storage definitions.
  *
  * @return array
  *   An associative array keyed by entity type id of change descriptors. Every
  *   entry is an associative array with the following optional keys:
  *   - entity_type: a scalar having only the DEFINITION_UPDATED value.
  *   - field_storage_definitions: an associative array keyed by field name of
  *     scalars having one value among:
  *     - DEFINITION_CREATED
  *     - DEFINITION_UPDATED
  *     - DEFINITION_DELETED
  */
 protected function getChangeList()
 {
     $this->entityManager->useCaches(FALSE);
     $change_list = array();
     foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
         $original = $this->entityManager->getLastInstalledDefinition($entity_type_id);
         // @todo Support non-storage-schema-changing definition updates too:
         //   https://www.drupal.org/node/2336895.
         if (!$original) {
             $change_list[$entity_type_id]['entity_type'] = static::DEFINITION_CREATED;
         } else {
             if ($this->requiresEntityStorageSchemaChanges($entity_type, $original)) {
                 $change_list[$entity_type_id]['entity_type'] = static::DEFINITION_UPDATED;
             }
             if ($this->entityManager->getStorage($entity_type_id) instanceof DynamicallyFieldableEntityStorageInterface) {
                 $field_changes = array();
                 $storage_definitions = $this->entityManager->getFieldStorageDefinitions($entity_type_id);
                 $original_storage_definitions = $this->entityManager->getLastInstalledFieldStorageDefinitions($entity_type_id);
                 // Detect created field storage definitions.
                 foreach (array_diff_key($storage_definitions, $original_storage_definitions) as $field_name => $storage_definition) {
                     $field_changes[$field_name] = static::DEFINITION_CREATED;
                 }
                 // Detect deleted field storage definitions.
                 foreach (array_diff_key($original_storage_definitions, $storage_definitions) as $field_name => $original_storage_definition) {
                     $field_changes[$field_name] = static::DEFINITION_DELETED;
                 }
                 // Detect updated field storage definitions.
                 foreach (array_intersect_key($storage_definitions, $original_storage_definitions) as $field_name => $storage_definition) {
                     // @todo Support non-storage-schema-changing definition updates too:
                     //   https://www.drupal.org/node/2336895. So long as we're checking
                     //   based on schema change requirements rather than definition
                     //   equality, skip the check if the entity type itself needs to be
                     //   updated, since that can affect the schema of all fields, so we
                     //   want to process that update first without reporting false
                     //   positives here.
                     if (!isset($change_list[$entity_type_id]['entity_type']) && $this->requiresFieldStorageSchemaChanges($storage_definition, $original_storage_definitions[$field_name])) {
                         $field_changes[$field_name] = static::DEFINITION_UPDATED;
                     }
                 }
                 if ($field_changes) {
                     $change_list[$entity_type_id]['field_storage_definitions'] = $field_changes;
                 }
             }
         }
     }
     // @todo Support deleting entity definitions when we support base field
     //   purging. See https://www.drupal.org/node/2282119.
     $this->entityManager->useCaches(TRUE);
     return array_filter($change_list);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:63,代码来源:EntityDefinitionUpdateManager.php

示例2: reloadEntity

 /**
  * Reloads the specified entity.
  *
  * @param \Drupal\entity_test\Entity\EntityTest $entity
  *   An entity object.
  *
  * @return \Drupal\entity_test\Entity\EntityTest
  *   The reloaded entity object.
  */
 protected function reloadEntity(EntityTest $entity)
 {
     $this->entityManager->useCaches(FALSE);
     $this->entityManager->getStorage('entity_test')->resetCache([$entity->id()]);
     return EntityTest::load($entity->id());
 }
开发者ID:aleph-n,项目名称:cms.aaenl,代码行数:15,代码来源:UpdateApiEntityDefinitionUpdateTest.php

示例3: useCaches

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


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