Issue #2380607 by Berdir, dawehner: Do not call ConfigBase::validateKeys() for data loaded from storage

8.0.x
Nathaniel Catchpole 2014-12-08 11:07:49 +00:00
parent fa31ac08fd
commit a943f5813b
3 changed files with 11 additions and 6 deletions

View File

@ -80,7 +80,6 @@ class Config extends StorableConfigBase {
parent::initWithData($data);
$this->settingsOverrides = array();
$this->moduleOverrides = array();
$this->setData($data);
return $this;
}
@ -109,8 +108,8 @@ class Config extends StorableConfigBase {
/**
* {@inheritdoc}
*/
public function setData(array $data) {
parent::setData($data);
public function setData(array $data, $validate_keys = TRUE) {
parent::setData($data, $validate_keys);
$this->resetOverriddenData();
return $this;
}

View File

@ -157,6 +157,10 @@ abstract class ConfigBase {
*
* @param array $data
* The new configuration data.
* @param bool $validate_keys
* (optional) Whether the data should be verified for valid keys. Set to
* FALSE if the $data is known to be valid already (for example, being
* loaded from the config storage).
*
* @return $this
* The configuration object.
@ -164,8 +168,10 @@ abstract class ConfigBase {
* @throws \Drupal\Core\Config\ConfigValueException
* If any key in $data in any depth contains a dot.
*/
public function setData(array $data) {
$this->validateKeys($data);
public function setData(array $data, $validate_keys = TRUE) {
if ($validate_keys) {
$this->validateKeys($data);
}
$this->data = $data;
return $this;
}

View File

@ -90,7 +90,7 @@ abstract class StorableConfigBase extends ConfigBase {
*/
public function initWithData(array $data) {
$this->isNew = FALSE;
$this->setData($data);
$this->setData($data, FALSE);
$this->originalData = $this->data;
return $this;
}