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


PHP StorageInterface::write方法代码示例

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


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

示例1: write

 /**
  * {@inheritdoc}
  */
 public function write($name, array $data)
 {
     if (isset($this->replacementData[$this->collection][$name])) {
         unset($this->replacementData[$this->collection][$name]);
     }
     return $this->storage->write($name, $data);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:StorageReplaceDataWrapper.php

示例2: write

 /**
  * {@inheritdoc}
  */
 public function write($name, array $data)
 {
     foreach ($this->filters as $filter) {
         $data = $filter->filterWrite($name, $data, $this->storage);
     }
     return $this->storage->write($name, $data);
 }
开发者ID:bjargud,项目名称:drush,代码行数:10,代码来源:StorageWrapper.php

示例3: write

 /**
  * {@inheritdoc}
  */
 public function write($name, array $data)
 {
     foreach ($this->filters as $filter) {
         $data = $filter->filterWrite($name, $data, $this->storage);
     }
     // filterWrite might return NULL, which means the config should be deleted.
     if (!isset($data)) {
         return $this->storage->delete($name);
     }
     return $this->storage->write($name, $data);
 }
开发者ID:gaelg,项目名称:drush,代码行数:14,代码来源:StorageWrapper.php

示例4: copyConfig

 /**
  * Copies configuration objects from source storage to target storage.
  *
  * @param \Drupal\Core\Config\StorageInterface $source_storage
  *   The source config storage service.
  * @param \Drupal\Core\Config\StorageInterface $target_storage
  *   The target config storage service.
  */
 protected function copyConfig(StorageInterface $source_storage, StorageInterface $target_storage)
 {
     $target_storage->deleteAll();
     foreach ($source_storage->listAll() as $name) {
         $target_storage->write($name, $source_storage->read($name));
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:15,代码来源:ConfigTestTrait.php

示例5: createItemSnapshot

 /**
  * Creates a snapshot of a given configuration item as provided by an
  * extension.
  *
  * @param FileStorage $extension_storage
  *   An extension's configuration file storage.
  * @param string $item_name
  *   The name of the configuration item.
  */
 function createItemSnapshot(FileStorage $extension_storage, $item_name)
 {
     // Snapshot the configuration item as provided by the extension.
     $extension_value = $extension_storage->read($item_name);
     $this->snapshotExtensionStorage->write($item_name, $extension_value);
     // Snapshot the configuration item as installed in the active storage.
     $active_value = $this->activeStorage->read($item_name);
     $this->snapshotActiveStorage->write($item_name, $active_value);
 }
开发者ID:robertfoleyjr,项目名称:robertfoleyjr-d8,代码行数:18,代码来源:ConfigSyncSnapshotter.php

示例6: write

 /**
  * {@inheritdoc}
  */
 public function write($name, array $data)
 {
     if ($this->storage->write($name, $data)) {
         // While not all written data is read back, setting the cache instead of
         // just deleting it avoids cache rebuild stampedes.
         $this->cache->set($this->getCacheKey($name), $data);
         $this->findByPrefixCache = array();
         return TRUE;
     }
     return FALSE;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:14,代码来源:CachedStorage.php

示例7: write

 /**
  * Implements Drupal\Core\Config\StorageInterface::write().
  */
 public function write($name, array $data)
 {
     if ($this->storage->write($name, $data)) {
         // While not all written data is read back, setting the cache instead of
         // just deleting it avoids cache rebuild stampedes.
         $this->cache->set($name, $data);
         Cache::deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
         $this->findByPrefixCache = array();
         return TRUE;
     }
     return FALSE;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:15,代码来源:CachedStorage.php

示例8: write

 /**
  * {@inheritdoc}
  */
 public function write($name, array $data)
 {
     return $this->baseStorage->write($name, $data);
 }
开发者ID:tedbow,项目名称:scheduled-updates-demo,代码行数:7,代码来源:SourceStorage.php

示例9: createSnapshot

 /**
  * {@inheritdoc}
  */
 public function createSnapshot(StorageInterface $source_storage, StorageInterface $snapshot_storage)
 {
     // Empty the snapshot of all configuration.
     $snapshot_storage->deleteAll();
     foreach ($snapshot_storage->getAllCollectionNames() as $collection) {
         $snapshot_collection = $snapshot_storage->createCollection($collection);
         $snapshot_collection->deleteAll();
     }
     foreach ($source_storage->listAll() as $name) {
         $snapshot_storage->write($name, $source_storage->read($name));
     }
     // Copy collections as well.
     foreach ($source_storage->getAllCollectionNames() as $collection) {
         $source_collection = $source_storage->createCollection($collection);
         $snapshot_collection = $snapshot_storage->createCollection($collection);
         foreach ($source_collection->listAll() as $name) {
             $snapshot_collection->write($name, $source_collection->read($name));
         }
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:23,代码来源:ConfigManager.php

示例10: testCollection

 /**
  * Tests that the storage supports collections.
  */
 public function testCollection()
 {
     $name = 'config_test.storage';
     $data = array('foo' => 'bar');
     $result = $this->storage->write($name, $data);
     $this->assertIdentical($result, TRUE);
     $this->assertIdentical($data, $this->storage->read($name));
     // Create configuration in a new collection.
     $new_storage = $this->storage->createCollection('collection.sub.new');
     $this->assertFalse($new_storage->exists($name));
     $this->assertEqual(array(), $new_storage->listAll());
     $new_storage->write($name, $data);
     $this->assertIdentical($result, TRUE);
     $this->assertIdentical($data, $new_storage->read($name));
     $this->assertEqual(array($name), $new_storage->listAll());
     $this->assertTrue($new_storage->exists($name));
     $new_data = array('foo' => 'baz');
     $new_storage->write($name, $new_data);
     $this->assertIdentical($result, TRUE);
     $this->assertIdentical($new_data, $new_storage->read($name));
     // Create configuration in another collection.
     $another_storage = $this->storage->createCollection('collection.sub.another');
     $this->assertFalse($another_storage->exists($name));
     $this->assertEqual(array(), $another_storage->listAll());
     $another_storage->write($name, $new_data);
     $this->assertIdentical($result, TRUE);
     $this->assertIdentical($new_data, $another_storage->read($name));
     $this->assertEqual(array($name), $another_storage->listAll());
     $this->assertTrue($another_storage->exists($name));
     // Create configuration in yet another collection.
     $alt_storage = $this->storage->createCollection('alternate');
     $alt_storage->write($name, $new_data);
     $this->assertIdentical($result, TRUE);
     $this->assertIdentical($new_data, $alt_storage->read($name));
     // Switch back to the collection-less mode and check the data still exists
     // add has not been touched.
     $this->assertIdentical($data, $this->storage->read($name));
     // Check that the getAllCollectionNames() method works.
     $this->assertIdentical(array('alternate', 'collection.sub.another', 'collection.sub.new'), $this->storage->getAllCollectionNames());
     // Check that the collections are removed when they are empty.
     $alt_storage->delete($name);
     $this->assertIdentical(array('collection.sub.another', 'collection.sub.new'), $this->storage->getAllCollectionNames());
     // Create configuration in collection called 'collection'. This ensures that
     // FileStorage's collection storage works regardless of its use of
     // subdirectories.
     $parent_storage = $this->storage->createCollection('collection');
     $this->assertFalse($parent_storage->exists($name));
     $this->assertEqual(array(), $parent_storage->listAll());
     $parent_storage->write($name, $new_data);
     $this->assertIdentical($result, TRUE);
     $this->assertIdentical($new_data, $parent_storage->read($name));
     $this->assertEqual(array($name), $parent_storage->listAll());
     $this->assertTrue($parent_storage->exists($name));
     $this->assertIdentical(array('collection', 'collection.sub.another', 'collection.sub.new'), $this->storage->getAllCollectionNames());
     $parent_storage->deleteAll();
     $this->assertIdentical(array('collection.sub.another', 'collection.sub.new'), $this->storage->getAllCollectionNames());
     // Check that the having an empty collection-less storage does not break
     // anything. Before deleting check that the previous delete did not affect
     // data in another collection.
     $this->assertIdentical($data, $this->storage->read($name));
     $this->storage->delete($name);
     $this->assertIdentical(array('collection.sub.another', 'collection.sub.new'), $this->storage->getAllCollectionNames());
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:66,代码来源:ConfigStorageTestBase.php


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