本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Config\ConfigInterface::all方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigInterface::all方法的具体用法?PHP ConfigInterface::all怎么用?PHP ConfigInterface::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityConfigBundle\Config\ConfigInterface
的用法示例。
在下文中一共展示了ConfigInterface::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dumpConfig
/**
* @param OutputInterface $output
* @param ConfigInterface $config
* @param string|null $attrName
*/
protected function dumpConfig(OutputInterface $output, ConfigInterface $config, $attrName = null)
{
$data = $config->all();
$res = [$config->getId()->getScope() => $data];
if (!empty($attrName) && (isset($data[$attrName]) || array_key_exists($attrName, $data))) {
$res = [$config->getId()->getScope() => [$attrName => $data[$attrName]]];
}
$output->writeln(print_r($res, true));
}
示例2: calculateConfigChangeSet
/**
* @param ConfigInterface $config
* @SuppressWarnings(PHPMD)
*/
public function calculateConfigChangeSet(ConfigInterface $config)
{
$originConfigValue = array();
if ($this->originalConfigs->containsKey($config->getId()->toString())) {
$originConfig = $this->originalConfigs->get($config->getId()->toString());
$originConfigValue = $originConfig->all();
}
foreach ($config->all() as $key => $value) {
if (!isset($originConfigValue[$key])) {
$originConfigValue[$key] = null;
}
}
$diffNew = array_udiff_assoc($config->all(), $originConfigValue, function ($a, $b) {
return $a == $b ? 0 : 1;
});
$diffOld = array_udiff_assoc($originConfigValue, $config->all(), function ($a, $b) {
return $a == $b ? 0 : 1;
});
$diff = array();
foreach ($diffNew as $key => $value) {
$oldValue = isset($diffOld[$key]) ? $diffOld[$key] : null;
$diff[$key] = array($oldValue, $value);
}
if (!$this->configChangeSets->containsKey($config->getId()->toString())) {
$this->configChangeSets->set($config->getId()->toString(), array());
}
if (count($diff)) {
$changeSet = array_merge($this->configChangeSets->get($config->getId()->toString()), $diff);
$this->configChangeSets->set($config->getId()->toString(), $changeSet);
}
}
示例3: changeConfigFieldName
/**
* In case of FieldConfigId replaces OLD field name with given NEW one
*
* @param ConfigInterface $config
* @param $newFieldName
* @return Config|ConfigInterface
*/
protected function changeConfigFieldName(ConfigInterface $config, $newFieldName)
{
$configId = $config->getId();
if ($configId instanceof FieldConfigId) {
$newConfigId = new FieldConfigId($configId->getScope(), $configId->getClassName(), $newFieldName, $configId->getFieldType());
$newConfig = new Config($newConfigId);
$newConfig->setValues($config->all());
$config = $newConfig;
}
return $config;
}
示例4: calculateConfigChangeSet
/**
* @param ConfigInterface $config
* @SuppressWarnings(PHPMD)
*/
public function calculateConfigChangeSet(ConfigInterface $config)
{
$configKey = $this->buildConfigKey($config->getId());
$originConfigValues = isset($this->originalConfigs[$configKey]) ? $this->originalConfigs[$configKey]->all() : [];
$configValues = $config->all();
foreach ($configValues as $key => $value) {
if (!isset($originConfigValues[$key])) {
$originConfigValues[$key] = null;
}
}
$diffNew = array_udiff_assoc($configValues, $originConfigValues, function ($a, $b) {
return $a == $b ? 0 : 1;
});
$diffOld = array_udiff_assoc($originConfigValues, $configValues, function ($a, $b) {
return $a == $b ? 0 : 1;
});
$diff = [];
foreach ($diffNew as $key => $value) {
$oldValue = isset($diffOld[$key]) ? $diffOld[$key] : null;
$diff[$key] = [$oldValue, $value];
}
if (!empty($diff)) {
$this->configChangeSets[$configKey] = isset($this->configChangeSets[$configKey]) ? array_merge($this->configChangeSets[$configKey], $diff) : $diff;
} elseif (!isset($this->configChangeSets[$configKey])) {
$this->configChangeSets[$configKey] = [];
}
}