Commit 3f84f73e authored by Bas de Nooijer's avatar Bas de Nooijer

- bugfix for ReadWrite document array implementation

parent bb26c423
...@@ -113,6 +113,7 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly ...@@ -113,6 +113,7 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
* Set a field value * Set a field value
* *
* If a field already has a value it will be overwritten. * If a field already has a value it will be overwritten.
* If you supply NULL as the value the field will be removed
* *
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value
...@@ -121,8 +122,12 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly ...@@ -121,8 +122,12 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
*/ */
public function setField($key, $value, $boost = null) public function setField($key, $value, $boost = null)
{ {
$this->_fields[$key] = $value; if ($value == null) {
$this->setFieldBoost($key, $boost); $this->removeField($key);
} else {
$this->_fields[$key] = $value;
$this->setFieldBoost($key, $boost);
}
return $this; return $this;
} }
...@@ -210,11 +215,7 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly ...@@ -210,11 +215,7 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
*/ */
public function __set($name, $value) public function __set($name, $value)
{ {
if ($value == null) { $this->setField($name, $value);
$this->removeField($name);
} else {
$this->setField($name, $value);
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment