CustomVariableDictionary: fix storage and more

This commit is contained in:
Thomas Gelf 2015-10-28 22:26:38 +01:00
parent 353427fa1a
commit 73b01b8cb5
1 changed files with 18 additions and 3 deletions

View File

@ -20,7 +20,7 @@ class CustomVariableDictionary extends CustomVariable implements Countable
}
foreach ($this->value as $key => $value) {
if ($this->$key->differsFrom($value)->$key) {
if (! $value->equals($var->$key)) {
return false;
}
}
@ -28,6 +28,16 @@ class CustomVariableDictionary extends CustomVariable implements Countable
return true;
}
public function getDbFormat()
{
return 'json';
}
public function getDbValue()
{
return json_encode($this->getValue());
}
public function setValue($value)
{
$new = array();
@ -49,7 +59,12 @@ class CustomVariableDictionary extends CustomVariable implements Countable
public function getValue()
{
return json_encode($this->value); // really?
$ret = array();
foreach ($this->value as $key => $var) {
$ret[$key] = $var->getValue();
}
return $ret;
}
public function listKeys()
@ -73,7 +88,7 @@ class CustomVariableDictionary extends CustomVariable implements Countable
public function __get($key)
{
// ...
return $this->value[$key];
}
public function toConfigString()