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


PHP TypedDataManager::clearCachedDefinitions方法代码示例

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


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

示例1: clearCachedDefinitions

 /**
  * {@inheritdoc}
  */
 public function clearCachedDefinitions()
 {
     $this->schemaStorage->reset();
     parent::clearCachedDefinitions();
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:8,代码来源:TypedConfigManager.php

示例2: clearCachedBundles

 /**
  * {@inheritdoc}
  */
 public function clearCachedBundles()
 {
     $this->bundleInfo = array();
     Cache::invalidateTags(array('entity_bundles'));
     // Entity bundles are exposed as data types, clear that cache too.
     $this->typedDataManager->clearCachedDefinitions();
 }
开发者ID:brstde,项目名称:gap1,代码行数:10,代码来源:EntityManager.php

示例3: testGetAllBundleInfo

 /**
  * Tests the getAllBundleInfo() method.
  *
  * @covers ::getAllBundleInfo
  */
 public function testGetAllBundleInfo()
 {
     $this->moduleHandler->invokeAll('entity_bundle_info')->willReturn([]);
     $this->moduleHandler->alter('entity_bundle_info', Argument::type('array'))->willReturn(NULL);
     $apple = $this->prophesize(EntityTypeInterface::class);
     $apple->getLabel()->willReturn('Apple');
     $apple->getBundleOf()->willReturn(NULL);
     $banana = $this->prophesize(EntityTypeInterface::class);
     $banana->getLabel()->willReturn('Banana');
     $banana->getBundleOf()->willReturn(NULL);
     $this->setUpEntityManager(array('apple' => $apple, 'banana' => $banana));
     $this->cacheBackend->get('entity_bundle_info:en')->willReturn(FALSE);
     $this->cacheBackend->get('entity_type')->willReturn(FALSE);
     $this->cacheBackend->set('entity_type', Argument::any(), Cache::PERMANENT, ['entity_types'])->shouldBeCalled();
     $this->cacheBackend->set('entity_bundle_info:en', Argument::any(), Cache::PERMANENT, ['entity_types', 'entity_bundles'])->will(function () {
         $this->get('entity_bundle_info:en')->willReturn((object) ['data' => 'cached data'])->shouldBeCalled();
     })->shouldBeCalled();
     $this->cacheTagsInvalidator->invalidateTags(['entity_types'])->shouldBeCalled();
     $this->cacheTagsInvalidator->invalidateTags(['entity_bundles'])->shouldBeCalled();
     $this->cacheTagsInvalidator->invalidateTags(['entity_field_info'])->shouldBeCalled();
     $this->typedDataManager->clearCachedDefinitions()->shouldBeCalled();
     $expected = array('apple' => array('apple' => array('label' => 'Apple')), 'banana' => array('banana' => array('label' => 'Banana')));
     $bundle_info = $this->entityManager->getAllBundleInfo();
     $this->assertSame($expected, $bundle_info);
     $bundle_info = $this->entityManager->getAllBundleInfo();
     $this->assertSame($expected, $bundle_info);
     $this->entityManager->clearCachedDefinitions();
     $bundle_info = $this->entityManager->getAllBundleInfo();
     $this->assertSame('cached data', $bundle_info);
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:35,代码来源:EntityManagerTest.php


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