Commit 30003238 authored by Bas de Nooijer's avatar Bas de Nooijer

- added support for configuration mode to the update query

parent b6698661
...@@ -68,6 +68,41 @@ class Solarium_Query_Update extends Solarium_Query ...@@ -68,6 +68,41 @@ class Solarium_Query_Update extends Solarium_Query
*/ */
protected $_commands = array(); protected $_commands = array();
/**
* Initialize options
*
* Several options need some extra checks or setup work, for these options
* the setters are called.
*
* @return void
*/
protected function _init()
{
if (isset($this->_options['command'])) {
foreach ($this->_options['command'] as $key => $value) {
switch ($value['type']) {
case 'delete':
$command = new Solarium_Query_Update_Command_Delete($value);
break;
case 'commit':
$command = new Solarium_Query_Update_Command_Commit($value);
break;
case 'optimize':
$command = new Solarium_Query_Update_Command_Optimize($value);
break;
case 'rollback':
$command = new Solarium_Query_Update_Command_Rollback($value);
break;
case 'add':
throw new Solarium_Exception("Adding documents is not supported in configuration, use the API for this");
}
$this->add($key, $command);
}
}
}
/** /**
* Get all commands for this update query * Get all commands for this update query
* *
......
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