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


PHP EntityInterface::delete方法代码示例

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


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

示例1: testReferencedEntity


//.........这里部分代码省略.........
         }
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_url, 'HIT');
         $this->verifyPageCache($listing_url, 'HIT');
         if ($is_special_case) {
             $this->verifyPageCache($empty_entity_listing_url, 'HIT');
             $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         }
     }
     if ($this->entity->getEntityType()->get('field_ui_base_route')) {
         // Verify that after modifying a configurable field on the entity, there
         // is a cache miss.
         $this->pass("Test modification of referenced entity's configurable field.", 'Debug');
         $field_storage_name = $this->entity->getEntityTypeId() . '.configurable_field';
         $field_storage = FieldStorageConfig::load($field_storage_name);
         $field_storage->save();
         $this->verifyPageCache($referencing_entity_url, 'MISS');
         $this->verifyPageCache($listing_url, 'MISS');
         $this->verifyPageCache($empty_entity_listing_url, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         $this->verifyPageCache($non_referencing_entity_url, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_url, 'HIT');
         $this->verifyPageCache($listing_url, 'HIT');
         // Verify that after modifying a configurable field on the entity, there
         // is a cache miss.
         $this->pass("Test modification of referenced entity's configurable field.", 'Debug');
         $field_name = $this->entity->getEntityTypeId() . '.' . $this->entity->bundle() . '.configurable_field';
         $field = FieldConfig::load($field_name);
         $field->save();
         $this->verifyPageCache($referencing_entity_url, 'MISS');
         $this->verifyPageCache($listing_url, 'MISS');
         $this->verifyPageCache($empty_entity_listing_url, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         $this->verifyPageCache($non_referencing_entity_url, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_url, 'HIT');
         $this->verifyPageCache($listing_url, 'HIT');
     }
     // Verify that after invalidating the entity's cache tag directly, there is
     // a cache miss for every route except the ones for the non-referencing
     // entity and the empty entity listing.
     $this->pass("Test invalidation of referenced entity's cache tag.", 'Debug');
     Cache::invalidateTags($this->entity->getCacheTagsToInvalidate());
     $this->verifyPageCache($referencing_entity_url, 'MISS');
     $this->verifyPageCache($listing_url, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_url, 'MISS');
     $this->verifyPageCache($non_referencing_entity_url, 'HIT');
     $this->verifyPageCache($empty_entity_listing_url, 'HIT');
     // Verify cache hits.
     $this->verifyPageCache($referencing_entity_url, 'HIT');
     $this->verifyPageCache($listing_url, 'HIT');
     $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
     // Verify that after invalidating the entity's list cache tag directly,
     // there is a cache miss for both the empty entity listing and the non-empty
     // entity listing routes, but not for other routes.
     $this->pass("Test invalidation of referenced entity's list cache tag.", 'Debug');
     Cache::invalidateTags($this->entity->getEntityType()->getListCacheTags());
     $this->verifyPageCache($empty_entity_listing_url, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_url, 'MISS');
     $this->verifyPageCache($referencing_entity_url, 'HIT');
     $this->verifyPageCache($non_referencing_entity_url, 'HIT');
     $this->verifyPageCache($listing_url, 'HIT');
     // Verify cache hits.
     $this->verifyPageCache($empty_entity_listing_url, 'HIT');
     $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
     if (!empty($view_cache_tag)) {
         // Verify that after invalidating the generic entity type's view cache tag
         // directly, there is a cache miss for both the referencing entity, and the
         // listing of referencing entities, but not for other routes.
         $this->pass("Test invalidation of referenced entity's 'view' cache tag.", 'Debug');
         Cache::invalidateTags($view_cache_tag);
         $this->verifyPageCache($referencing_entity_url, 'MISS');
         $this->verifyPageCache($listing_url, 'MISS');
         $this->verifyPageCache($non_referencing_entity_url, 'HIT');
         $this->verifyPageCache($empty_entity_listing_url, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_url, 'HIT');
         $this->verifyPageCache($listing_url, 'HIT');
     }
     // Verify that after deleting the entity, there is a cache miss for every
     // route except for the non-referencing entity one.
     $this->pass('Test deletion of referenced entity.', 'Debug');
     $this->entity->delete();
     $this->verifyPageCache($referencing_entity_url, 'MISS');
     $this->verifyPageCache($listing_url, 'MISS');
     $this->verifyPageCache($empty_entity_listing_url, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_url, 'MISS');
     $this->verifyPageCache($non_referencing_entity_url, 'HIT');
     // Verify cache hits.
     $referencing_entity_cache_tags = Cache::mergeTags($this->referencingEntity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags());
     $referencing_entity_cache_tags = Cache::mergeTags($referencing_entity_cache_tags, ['rendered']);
     $nonempty_entity_listing_cache_tags = Cache::mergeTags($this->entity->getEntityType()->getListCacheTags(), $this->getAdditionalCacheTagsForEntityListing());
     $nonempty_entity_listing_cache_tags = Cache::mergeTags($nonempty_entity_listing_cache_tags, $page_cache_tags);
     $this->verifyPageCache($referencing_entity_url, 'HIT', Cache::mergeTags($referencing_entity_cache_tags, $page_cache_tags));
     $this->verifyPageCache($listing_url, 'HIT', $page_cache_tags);
     $this->verifyPageCache($empty_entity_listing_url, 'HIT', $empty_entity_listing_cache_tags);
     $this->verifyPageCache($nonempty_entity_listing_url, 'HIT', $nonempty_entity_listing_cache_tags);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:101,代码来源:EntityCacheTagsTestBase.php

示例2: delete

 /**
  * Responds to entity DELETE requests.
  *
  * @param \Drupal\Core\Entity\EntityInterface $entity
  *   The entity object.
  *
  * @return \Drupal\rest\ResourceResponse
  *   The HTTP response object.
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function delete(EntityInterface $entity)
 {
     if (!$entity->access('delete')) {
         throw new AccessDeniedHttpException();
     }
     try {
         $entity->delete();
         $this->logger->notice('Deleted entity %type with ID %id.', array('%type' => $entity->getEntityTypeId(), '%id' => $entity->id()));
         // Delete responses have an empty body.
         return new ResourceResponse(NULL, 204);
     } catch (EntityStorageException $e) {
         throw new HttpException(500, 'Internal Server Error', $e);
     }
 }
开发者ID:RealLukeMartin,项目名称:drupal8tester,代码行数:25,代码来源:EntityResource.php

示例3: delete

 /**
  * Responds to entity DELETE requests.
  *
  * @Thruway(name = "remove", type="procedure")
  *
  * @param \Drupal\Core\Entity\EntityInterface $entity
  *   The entity object.
  *
  * @return array
  *
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  */
 public function delete(EntityInterface $entity)
 {
     if (!$entity->access('delete')) {
         throw new AccessDeniedHttpException();
     }
     try {
         $entity->enforceIsNew(FALSE);
         $entity->delete();
         //            $this->logger->notice(
         //                'Deleted entity %type with ID %id.',
         //                array('%type' => $entity->getEntityTypeId(), '%id' => $entity->id())
         //            );
         // Delete responses have an empty body.
         return $entity;
     } catch (EntityStorageException $e) {
         throw new HttpException(500, t('Internal Server Error'), $e);
     }
 }
开发者ID:voryx,项目名称:ThruwayDrupal,代码行数:30,代码来源:EntityResource.php

示例4: testReferencedEntity


//.........这里部分代码省略.........
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
         if ($is_special_case) {
             $this->verifyPageCache($empty_entity_listing_path, 'HIT');
             $this->verifyPageCache($nonempty_entity_listing_path, 'HIT');
         }
     }
     if ($this->entity->getEntityType()->get('field_ui_base_route')) {
         // Verify that after modifying a configurable field on the entity, there
         // is a cache miss.
         $this->pass("Test modification of referenced entity's configurable field.", 'Debug');
         $field_storage_name = $this->entity->getEntityTypeId() . '.configurable_field';
         $field_storage = entity_load('field_storage_config', $field_storage_name);
         $field_storage->save();
         $this->verifyPageCache($referencing_entity_path, 'MISS');
         $this->verifyPageCache($listing_path, 'MISS');
         $this->verifyPageCache($empty_entity_listing_path, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_path, 'HIT');
         $this->verifyPageCache($non_referencing_entity_path, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
         // Verify that after modifying a configurable field on the entity, there
         // is a cache miss.
         $this->pass("Test modification of referenced entity's configurable field.", 'Debug');
         $field_name = $this->entity->getEntityTypeId() . '.' . $this->entity->bundle() . '.configurable_field';
         $field = entity_load('field_config', $field_name);
         $field->save();
         $this->verifyPageCache($referencing_entity_path, 'MISS');
         $this->verifyPageCache($listing_path, 'MISS');
         $this->verifyPageCache($empty_entity_listing_path, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_path, 'HIT');
         $this->verifyPageCache($non_referencing_entity_path, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
     }
     // Verify that after invalidating the entity's cache tag directly, there is
     // a cache miss for every route except the ones for the non-referencing
     // entity and the empty entity listing.
     $this->pass("Test invalidation of referenced entity's cache tag.", 'Debug');
     Cache::invalidateTags($this->entity->getCacheTags());
     $this->verifyPageCache($referencing_entity_path, 'MISS');
     $this->verifyPageCache($listing_path, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_path, 'MISS');
     $this->verifyPageCache($non_referencing_entity_path, 'HIT');
     $this->verifyPageCache($empty_entity_listing_path, 'HIT');
     // Verify cache hits.
     $this->verifyPageCache($referencing_entity_path, 'HIT');
     $this->verifyPageCache($listing_path, 'HIT');
     $this->verifyPageCache($nonempty_entity_listing_path, 'HIT');
     // Verify that after invalidating the entity's list cache tag directly,
     // there is a cache miss for both the empty entity listing and the non-empty
     // entity listing routes, but not for other routes.
     $this->pass("Test invalidation of referenced entity's list cache tag.", 'Debug');
     Cache::invalidateTags($this->entity->getEntityType()->getListCacheTags());
     $this->verifyPageCache($empty_entity_listing_path, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_path, 'MISS');
     $this->verifyPageCache($referencing_entity_path, 'HIT');
     $this->verifyPageCache($non_referencing_entity_path, 'HIT');
     $this->verifyPageCache($listing_path, 'HIT');
     // Verify cache hits.
     $this->verifyPageCache($empty_entity_listing_path, 'HIT');
     $this->verifyPageCache($nonempty_entity_listing_path, 'HIT');
     if (!empty($view_cache_tag)) {
         // Verify that after invalidating the generic entity type's view cache tag
         // directly, there is a cache miss for both the referencing entity, and the
         // listing of referencing entities, but not for other routes.
         $this->pass("Test invalidation of referenced entity's 'view' cache tag.", 'Debug');
         Cache::invalidateTags($view_cache_tag);
         $this->verifyPageCache($referencing_entity_path, 'MISS');
         $this->verifyPageCache($listing_path, 'MISS');
         $this->verifyPageCache($non_referencing_entity_path, 'HIT');
         $this->verifyPageCache($empty_entity_listing_path, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_path, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
     }
     // Verify that after deleting the entity, there is a cache miss for every
     // route except for the the non-referencing entity one.
     $this->pass('Test deletion of referenced entity.', 'Debug');
     $this->entity->delete();
     $this->verifyPageCache($referencing_entity_path, 'MISS');
     $this->verifyPageCache($listing_path, 'MISS');
     $this->verifyPageCache($empty_entity_listing_path, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_path, 'MISS');
     $this->verifyPageCache($non_referencing_entity_path, 'HIT');
     // Verify cache hits.
     $referencing_entity_cache_tags = Cache::mergeTags($this->referencing_entity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags());
     $tags = Cache::mergeTags($render_cache_tags, $theme_cache_tags, $referencing_entity_cache_tags);
     $this->verifyPageCache($referencing_entity_path, 'HIT', $tags);
     $tags = Cache::mergeTags($render_cache_tags, $theme_cache_tags);
     $this->verifyPageCache($listing_path, 'HIT', $tags);
     $tags = Cache::mergeTags($render_cache_tags, $theme_cache_tags, $this->entity->getEntityType()->getListCacheTags());
     $this->verifyPageCache($empty_entity_listing_path, 'HIT', $tags);
     $tags = Cache::mergeTags($tags, $this->getAdditionalCacheTagsForEntityListing());
     $this->verifyPageCache($nonempty_entity_listing_path, 'HIT', $tags);
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:101,代码来源:EntityCacheTagsTestBase.php

示例5: testReferencedEntity


//.........这里部分代码省略.........
     $this->verifyPageCache($listing_path, 'HIT');
     $this->verifyPageCache($non_referencing_entity_path, 'MISS');
     // Verify cache hits.
     $this->verifyPageCache($non_referencing_entity_path, 'HIT');
     if ($this->entity->getEntityType()->hasControllerClass('view_builder')) {
         // Verify that after modifying the entity's display, there is a cache miss
         // for both the referencing entity, and the listing of referencing
         // entities, but not for the non-referencing entity.
         $referenced_entity_view_mode = $this->selectViewMode($this->entity->getEntityTypeId());
         $this->pass("Test modification of referenced entity's '{$referenced_entity_view_mode}' display.", 'Debug');
         $entity_display = entity_get_display($entity_type, $this->entity->bundle(), $referenced_entity_view_mode);
         $entity_display->save();
         $this->verifyPageCache($referencing_entity_path, 'MISS');
         $this->verifyPageCache($listing_path, 'MISS');
         $this->verifyPageCache($non_referencing_entity_path, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
     }
     $bundle_entity_type = $this->entity->getEntityType()->getBundleEntityType();
     if ($bundle_entity_type !== 'bundle') {
         // Verify that after modifying the corresponding bundle entity, there is a
         // cache miss for both the referencing entity, and the listing of
         // referencing entities, but not for the non-referencing entity.
         $this->pass("Test modification of referenced entity's bundle entity.", 'Debug');
         $bundle_entity = entity_load($bundle_entity_type, $this->entity->bundle());
         $bundle_entity->save();
         $this->verifyPageCache($referencing_entity_path, 'MISS');
         $this->verifyPageCache($listing_path, 'MISS');
         $this->verifyPageCache($non_referencing_entity_path, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
     }
     if ($this->entity->getEntityType()->isFieldable()) {
         // Verify that after modifying a configurable field on the entity, there
         // is a cache miss.
         $this->pass("Test modification of referenced entity's configurable field.", 'Debug');
         $field_name = $this->entity->getEntityTypeId() . '.configurable_field';
         $field_storage = entity_load('field_storage_config', $field_name);
         $field_storage->save();
         $this->verifyPageCache($referencing_entity_path, 'MISS');
         $this->verifyPageCache($listing_path, 'MISS');
         $this->verifyPageCache($non_referencing_entity_path, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
         // Verify that after modifying a configurable field instance on the
         // entity, there is a cache miss.
         $this->pass("Test modification of referenced entity's configurable field instance.", 'Debug');
         $field_instance_name = $this->entity->getEntityTypeId() . '.' . $this->entity->bundle() . '.configurable_field';
         $field_instance = entity_load('field_instance_config', $field_instance_name);
         $field_instance->save();
         $this->verifyPageCache($referencing_entity_path, 'MISS');
         $this->verifyPageCache($listing_path, 'MISS');
         $this->verifyPageCache($non_referencing_entity_path, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
     }
     // Verify that after invalidating the entity's cache tag directly,  there is
     // a cache miss for both the referencing entity, and the listing of
     // referencing entities, but not for the non-referencing entity.
     $this->pass("Test invalidation of referenced entity's cache tag.", 'Debug');
     Cache::invalidateTags($this->entity->getCacheTag());
     $this->verifyPageCache($referencing_entity_path, 'MISS');
     $this->verifyPageCache($listing_path, 'MISS');
     $this->verifyPageCache($non_referencing_entity_path, 'HIT');
     // Verify cache hits.
     $this->verifyPageCache($referencing_entity_path, 'HIT');
     $this->verifyPageCache($listing_path, 'HIT');
     if (!empty($view_cache_tag)) {
         // Verify that after invalidating the generic entity type's view cache tag
         // directly, there is a cache miss for both the referencing entity, and the
         // listing of referencing entities, but not for the non-referencing entity.
         $this->pass("Test invalidation of referenced entity's 'view' cache tag.", 'Debug');
         Cache::invalidateTags($view_cache_tag);
         $this->verifyPageCache($referencing_entity_path, 'MISS');
         $this->verifyPageCache($listing_path, 'MISS');
         $this->verifyPageCache($non_referencing_entity_path, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_path, 'HIT');
         $this->verifyPageCache($listing_path, 'HIT');
     }
     // Verify that after deleting the entity, there is a cache miss for both the
     // referencing entity, and the listing of referencing entities, but not for
     // the non-referencing entity.
     $this->pass('Test deletion of referenced entity.', 'Debug');
     $this->entity->delete();
     $this->verifyPageCache($referencing_entity_path, 'MISS');
     $this->verifyPageCache($listing_path, 'MISS');
     $this->verifyPageCache($non_referencing_entity_path, 'HIT');
     // Verify cache hits.
     $referencing_entity_cache_tags = NestedArray::mergeDeep($this->referencing_entity->getCacheTag(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTag());
     $referencing_entity_cache_tags = explode(' ', HtmlViewSubscriber::convertCacheTagsToHeader($referencing_entity_cache_tags));
     $tags = array_merge($render_cache_tags, $theme_cache_tags, $referencing_entity_cache_tags);
     $this->verifyPageCache($referencing_entity_path, 'HIT', $tags);
     $tags = array_merge($render_cache_tags, $theme_cache_tags);
     $this->verifyPageCache($listing_path, 'HIT', $tags);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:101,代码来源:EntityCacheTagsTestBase.php

示例6: testReferencedEntity


//.........这里部分代码省略.........
         } else {
             $this->verifyPageCache($empty_entity_listing_url, 'HIT');
             $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         }
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_url, 'HIT');
         $this->verifyPageCache($listing_url, 'HIT');
         if ($is_special_case) {
             $this->verifyPageCache($empty_entity_listing_url, 'HIT');
             $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         }
     }
     if ($this->entity->getEntityType()->get('field_ui_base_route')) {
         // Verify that after modifying a configurable field on the entity, there
         // is a cache miss.
         $this->pass("Test modification of referenced entity's configurable field.", 'Debug');
         $field_storage_name = $this->entity->getEntityTypeId() . '.configurable_field';
         $field_storage = FieldStorageConfig::load($field_storage_name);
         $field_storage->save();
         $this->verifyPageCache($referencing_entity_url, 'MISS');
         $this->verifyPageCache($listing_url, 'MISS');
         $this->verifyPageCache($empty_entity_listing_url, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         $this->verifyPageCache($non_referencing_entity_url, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_url, 'HIT');
         $this->verifyPageCache($listing_url, 'HIT');
         // Verify that after modifying a configurable field on the entity, there
         // is a cache miss.
         $this->pass("Test modification of referenced entity's configurable field.", 'Debug');
         $field_name = $this->entity->getEntityTypeId() . '.' . $this->entity->bundle() . '.configurable_field';
         $field = FieldConfig::load($field_name);
         $field->save();
         $this->verifyPageCache($referencing_entity_url, 'MISS');
         $this->verifyPageCache($listing_url, 'MISS');
         $this->verifyPageCache($empty_entity_listing_url, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         $this->verifyPageCache($non_referencing_entity_url, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_url, 'HIT');
         $this->verifyPageCache($listing_url, 'HIT');
     }
     // Verify that after invalidating the entity's cache tag directly, there is
     // a cache miss for every route except the ones for the non-referencing
     // entity and the empty entity listing.
     $this->pass("Test invalidation of referenced entity's cache tag.", 'Debug');
     Cache::invalidateTags($this->entity->getCacheTags());
     $this->verifyPageCache($referencing_entity_url, 'MISS');
     $this->verifyPageCache($listing_url, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_url, 'MISS');
     $this->verifyPageCache($non_referencing_entity_url, 'HIT');
     $this->verifyPageCache($empty_entity_listing_url, 'HIT');
     // Verify cache hits.
     $this->verifyPageCache($referencing_entity_url, 'HIT');
     $this->verifyPageCache($listing_url, 'HIT');
     $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
     // Verify that after invalidating the entity's list cache tag directly,
     // there is a cache miss for both the empty entity listing and the non-empty
     // entity listing routes, but not for other routes.
     $this->pass("Test invalidation of referenced entity's list cache tag.", 'Debug');
     Cache::invalidateTags($this->entity->getEntityType()->getListCacheTags());
     $this->verifyPageCache($empty_entity_listing_url, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_url, 'MISS');
     $this->verifyPageCache($referencing_entity_url, 'HIT');
     $this->verifyPageCache($non_referencing_entity_url, 'HIT');
     $this->verifyPageCache($listing_url, 'HIT');
     // Verify cache hits.
     $this->verifyPageCache($empty_entity_listing_url, 'HIT');
     $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
     if (!empty($view_cache_tag)) {
         // Verify that after invalidating the generic entity type's view cache tag
         // directly, there is a cache miss for both the referencing entity, and the
         // listing of referencing entities, but not for other routes.
         $this->pass("Test invalidation of referenced entity's 'view' cache tag.", 'Debug');
         Cache::invalidateTags($view_cache_tag);
         $this->verifyPageCache($referencing_entity_url, 'MISS');
         $this->verifyPageCache($listing_url, 'MISS');
         $this->verifyPageCache($non_referencing_entity_url, 'HIT');
         $this->verifyPageCache($empty_entity_listing_url, 'HIT');
         $this->verifyPageCache($nonempty_entity_listing_url, 'HIT');
         // Verify cache hits.
         $this->verifyPageCache($referencing_entity_url, 'HIT');
         $this->verifyPageCache($listing_url, 'HIT');
     }
     // Verify that after deleting the entity, there is a cache miss for every
     // route except for the non-referencing entity one.
     $this->pass('Test deletion of referenced entity.', 'Debug');
     $this->entity->delete();
     $this->verifyPageCache($referencing_entity_url, 'MISS');
     $this->verifyPageCache($listing_url, 'MISS');
     $this->verifyPageCache($empty_entity_listing_url, 'MISS');
     $this->verifyPageCache($nonempty_entity_listing_url, 'MISS');
     $this->verifyPageCache($non_referencing_entity_url, 'HIT');
     // Verify cache hits.
     $referencing_entity_cache_tags = Cache::mergeTags($this->referencing_entity->getCacheTags(), \Drupal::entityManager()->getViewBuilder('entity_test')->getCacheTags(), ['rendered']);
     $this->verifyPageCache($referencing_entity_url, 'HIT', Cache::mergeTags($referencing_entity_cache_tags, $page_cache_tags));
     $this->verifyPageCache($listing_url, 'HIT', $page_cache_tags);
     $this->verifyPageCache($empty_entity_listing_url, 'HIT', $empty_entity_listing_cache_tags);
     $this->verifyPageCache($nonempty_entity_listing_url, 'HIT', Cache::mergeTags($this->entity->getEntityType()->getListCacheTags(), $this->getAdditionalCacheTagsForEntityListing(), $page_cache_tags));
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:101,代码来源:EntityCacheTagsTestBase.php

示例7: doExecute

 /**
  * Deletes the Entity.
  *
  * @param \Drupal\Core\Entity\EntityInterface $entity
  *    The entity to be deleted.
  */
 protected function doExecute(EntityInterface $entity)
 {
     $entity->delete();
 }
开发者ID:Progressable,项目名称:openway8,代码行数:10,代码来源:EntityDelete.php


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