本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Config\ConfigManager::getConfigChangeSet方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::getConfigChangeSet方法的具体用法?PHP ConfigManager::getConfigChangeSet怎么用?PHP ConfigManager::getConfigChangeSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityConfigBundle\Config\ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getConfigChangeSet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConfigChangeSet
public function testConfigChangeSet()
{
$configId = new EntityConfigId('entity', self::ENTITY_CLASS);
$originalConfig = $this->getConfig($configId, ['item1' => true, 'item11' => true, 'item12' => true, 'item2' => 123, 'item21' => 123, 'item22' => 123, 'item3' => 'val2', 'item4' => 'val4', 'item6' => null, 'item7' => 'val7']);
$this->configCache->expects($this->once())->method('getEntityConfig')->willReturn($originalConfig);
$this->configManager->getConfig($configId);
$changedConfig = $this->getConfig($configId, ['item1' => true, 'item11' => 1, 'item12' => false, 'item2' => 123, 'item21' => '123', 'item22' => 456, 'item3' => 'val21', 'item5' => 'val5', 'item6' => 'val6', 'item7' => null]);
$this->configManager->persist($changedConfig);
$this->configManager->calculateConfigChangeSet($changedConfig);
$this->assertEquals(['item12' => [true, false], 'item22' => [123, 456], 'item3' => ['val2', 'val21'], 'item5' => [null, 'val5'], 'item6' => [null, 'val6'], 'item7' => ['val7', null]], $this->configManager->getConfigChangeSet($changedConfig));
}
示例2: computeChanges
/**
* @param ConfigInterface $config
* @param ConfigManager $configManager
*
* @return ConfigLogDiff
*/
protected function computeChanges(ConfigInterface $config, ConfigManager $configManager)
{
$configId = $config->getId();
$internalValues = $configManager->getProvider($configId->getScope())->getPropertyConfig()->getNotAuditableValues($configId);
$changes = array_diff_key($configManager->getConfigChangeSet($config), $internalValues);
if (empty($changes)) {
return null;
}
$diff = new ConfigLogDiff();
$diff->setScope($configId->getScope());
$diff->setDiff($changes);
$diff->setClassName($configId->getClassName());
if ($configId instanceof FieldConfigId) {
$diff->setFieldName($configId->getFieldName());
}
return $diff;
}