當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。