本文整理汇总了PHP中Drupal\Core\Config\StorageInterface::readMultiple方法的典型用法代码示例。如果您正苦于以下问题:PHP StorageInterface::readMultiple方法的具体用法?PHP StorageInterface::readMultiple怎么用?PHP StorageInterface::readMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Config\StorageInterface
的用法示例。
在下文中一共展示了StorageInterface::readMultiple方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readMultiple
/**
* {@inheritdoc}
*/
public function readMultiple(array $names)
{
$data = $this->storage->readMultiple($names);
foreach ($names as $name) {
if (isset($this->replacementData[$this->collection][$name])) {
$data[$name] = $this->replacementData[$this->collection][$name];
}
}
return $data;
}
示例2: getDefinitions
/**
* {@inheritdoc}
*/
public function getDefinitions()
{
$definitions = array();
foreach ($this->schemaStorage->readMultiple($this->schemaStorage->listAll()) as $schema) {
foreach ($schema as $type => $definition) {
$definitions[$type] = $definition;
}
}
return $definitions;
}
示例3: readMultiple
/**
* {@inheritdoc}
*/
public function readMultiple(array $names)
{
$dataList = $this->storage->readMultiple($names);
$result = array();
foreach ($dataList as $name => $data) {
foreach ($this->filters as $filter) {
$data = $filter->filterRead($name, $data);
}
$result[$name] = $data;
}
return $result;
}
示例4: readMultiple
/**
* {@inheritdoc}
*/
public function readMultiple(array $names)
{
$data_to_return = array();
$cache_keys_map = $this->getCacheKeys($names);
$cache_keys = array_values($cache_keys_map);
$cached_list = $this->cache->getMultiple($cache_keys);
if (!empty($cache_keys)) {
// $cache_keys_map contains the full $name => $cache_key map, while
// $cache_keys contains just the $cache_key values that weren't found in
// the cache.
// @see \Drupal\Core\Cache\CacheBackendInterface::getMultiple()
$names_to_get = array_keys(array_intersect($cache_keys_map, $cache_keys));
$list = $this->storage->readMultiple($names_to_get);
// Cache configuration objects that were loaded from the storage, cache
// missing configuration objects as an explicit FALSE.
$items = array();
foreach ($names_to_get as $name) {
$data = isset($list[$name]) ? $list[$name] : FALSE;
$data_to_return[$name] = $data;
$items[$cache_keys_map[$name]] = array('data' => $data);
}
$this->cache->setMultiple($items);
}
// Add the configuration objects from the cache to the list.
$cache_keys_inverse_map = array_flip($cache_keys_map);
foreach ($cached_list as $cache_key => $cache) {
$name = $cache_keys_inverse_map[$cache_key];
$data_to_return[$name] = $cache->data;
}
// Ensure that only existing configuration objects are returned, filter out
// cached information about missing objects.
return array_filter($data_to_return);
}
示例5: readMultiple
/**
* {@inheritdoc}
*/
public function readMultiple(array $names)
{
$list = array();
// The names array is passed by reference and will only contain the names of
// config object not found after the method call.
// @see \Drupal\Core\Cache\CacheBackendInterface::getMultiple()
$cached_list = $this->cache->getMultiple($names);
if (!empty($names)) {
$list = $this->storage->readMultiple($names);
// Cache configuration objects that were loaded from the storage, cache
// missing configuration objects as an explicit FALSE.
$items = array();
foreach ($names as $name) {
$items[$name] = array('data' => isset($list[$name]) ? $list[$name] : FALSE);
}
$this->cache->setMultiple($items);
}
// Add the configuration objects from the cache to the list.
foreach ($cached_list as $name => $cache) {
$list[$name] = $cache->data;
}
// Ensure that only existing configuration objects are returned, filter out
// cached information about missing objects.
return array_filter($list);
}
示例6: readMultiple
/**
* {@inheritdoc}
*/
public function readMultiple(array $names)
{
$dataList = $this->storage->readMultiple($names);
$result = array();
// We also need to read the configs which are only on one of the two storages.
foreach ($names as $name) {
if (!isset($dataList[$name])) {
$dataList[$name] = NULL;
}
}
foreach ($dataList as $name => $data) {
foreach ($this->filters as $filter) {
$data = $filter->filterRead($name, $data, $this->storage);
}
$result[$name] = $data;
}
return $result;
}
示例7: getConfigDependencyManager
/**
* {@inheritdoc}
*/
public function getConfigDependencyManager()
{
$dependency_manager = new ConfigDependencyManager();
// This uses the configuration storage directly to avoid blowing the static
// caches in the configuration factory and the configuration entity system.
// Additionally this ensures that configuration entity dependency discovery
// has no dependencies on the config entity classes. Assume data with UUID
// is a config entity. Only configuration entities can be depended on so we
// can ignore everything else.
$data = array_filter($this->activeStorage->readMultiple($this->activeStorage->listAll()), function ($config) {
return isset($config['uuid']);
});
$dependency_manager->setData($data);
return $dependency_manager;
}
示例8: getDefinitions
/**
* {@inheritdoc}
*/
public function getDefinitions()
{
if (!isset($this->definitions)) {
if ($cache = $this->cache->get($this::CACHE_ID)) {
$this->definitions = $cache->data;
} else {
$this->definitions = array();
foreach ($this->schemaStorage->readMultiple($this->schemaStorage->listAll()) as $schema) {
foreach ($schema as $type => $definition) {
$this->definitions[$type] = $definition;
}
}
$this->cache->set($this::CACHE_ID, $this->definitions);
}
}
return $this->definitions;
}
示例9: findMissingContentDependencies
/**
* {@inheritdoc}
*/
public function findMissingContentDependencies()
{
$content_dependencies = array();
$missing_dependencies = array();
foreach ($this->activeStorage->readMultiple($this->activeStorage->listAll()) as $config_data) {
if (isset($config_data['dependencies']['content'])) {
$content_dependencies = array_merge($content_dependencies, $config_data['dependencies']['content']);
}
}
foreach (array_unique($content_dependencies) as $content_dependency) {
// Format of the dependency is entity_type:bundle:uuid.
list($entity_type, $bundle, $uuid) = explode(':', $content_dependency, 3);
if (!$this->entityManager->loadEntityByUuid($entity_type, $uuid)) {
$missing_dependencies[$uuid] = array('entity_type' => $entity_type, 'bundle' => $bundle, 'uuid' => $uuid);
}
}
return $missing_dependencies;
}
示例10: loadMultiple
/**
* {@inheritdoc}
*/
public function loadMultiple(array $names)
{
$list = array();
foreach ($names as $key => $name) {
// @todo: Deleted configuration stays in $this->cache, only return
// configuration objects that are not new.
$cache_key = $this->getConfigCacheKey($name);
if (isset($this->cache[$cache_key]) && !$this->cache[$cache_key]->isNew()) {
$list[$name] = $this->cache[$cache_key];
unset($names[$key]);
}
}
// Pre-load remaining configuration files.
if (!empty($names)) {
// Initialise override information.
$module_overrides = array();
$storage_data = $this->storage->readMultiple($names);
if ($this->useOverrides && !empty($storage_data)) {
// Only get module overrides if we have configuration to override.
$module_overrides = $this->loadOverrides($names);
}
foreach ($storage_data as $name => $data) {
$cache_key = $this->getConfigCacheKey($name);
$this->cache[$cache_key] = new Config($name, $this->storage, $this->eventDispatcher, $this->typedConfigManager);
$this->cache[$cache_key]->initWithData($data);
if ($this->useOverrides) {
if (isset($module_overrides[$name])) {
$this->cache[$cache_key]->setModuleOverride($module_overrides[$name]);
}
if (isset($GLOBALS['config'][$name])) {
$this->cache[$cache_key]->setSettingsOverride($GLOBALS['config'][$name]);
}
}
$list[$name] = $this->cache[$cache_key];
}
}
return $list;
}
示例11: doLoadMultiple
/**
* Returns a list of configuration objects for the given names.
*
* @param array $names
* List of names of configuration objects.
* @param bool $immutable
* (optional) Create an immutable configuration objects. Defaults to TRUE.
*
* @return \Drupal\Core\Config\Config[]|\Drupal\Core\Config\ImmutableConfig[]
* List of successfully loaded configuration objects, keyed by name.
*/
protected function doLoadMultiple(array $names, $immutable = TRUE)
{
$list = array();
foreach ($names as $key => $name) {
$cache_key = $this->getConfigCacheKey($name, $immutable);
if (isset($this->cache[$cache_key])) {
$list[$name] = $this->cache[$cache_key];
unset($names[$key]);
}
}
// Pre-load remaining configuration files.
if (!empty($names)) {
// Initialise override information.
$module_overrides = array();
$storage_data = $this->storage->readMultiple($names);
if ($immutable && !empty($storage_data)) {
// Only get module overrides if we have configuration to override.
$module_overrides = $this->loadOverrides($names);
}
foreach ($storage_data as $name => $data) {
$cache_key = $this->getConfigCacheKey($name, $immutable);
$this->cache[$cache_key] = $this->createConfigObject($name, $immutable);
$this->cache[$cache_key]->initWithData($data);
if ($immutable) {
if (isset($module_overrides[$name])) {
$this->cache[$cache_key]->setModuleOverride($module_overrides[$name]);
}
if (isset($GLOBALS['config'][$name])) {
$this->cache[$cache_key]->setSettingsOverride($GLOBALS['config'][$name]);
}
}
$this->propagateConfigOverrideCacheability($cache_key, $name);
$list[$name] = $this->cache[$cache_key];
}
}
return $list;
}