00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 class MassDeleteCommand extends CommandTransactional {
00013
00014
00015
00016
00017
00018 protected function do_execute() {
00019 $ret = new Status();
00020 $o = DB::create($this->get_instance());
00021 if ($o) {
00022 foreach(Arr::force($this->get_params(), false) as $key => $value) {
00023 if ($value instanceof IDBWhere) {
00024 $o->add_where_object($value);
00025 }
00026 else if ($value instanceof DBCondition) {
00027 $o->add_where($value->column, $value->operator, $value->value);
00028 }
00029 else if (is_int($key)) {
00030 $o->add_where($value);
00031 }
00032 else {
00033 $o->add_where($key, '=', $value);
00034 }
00035 }
00036 $ret->merge($o->delete(DataObjectBase::WHERE_ONLY));
00037 }
00038 else {
00039 $ret->append(tr('Delete Command: No valid instance type set', 'core'));
00040 }
00041 return $ret;
00042 }
00043 }