gyro/modules/status/behaviour/commands/generics/setstatus.cmd.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Command to set status. Expects new status as $param 00004 * 00005 * This command sets status on given IStatusHolder instance 00006 * and updates afterwards 00007 * 00008 * @author Gerd Riesselmann 00009 * @ingroup Status 00010 */ 00011 class SetstatusCommand extends CommandTransactional { 00012 /** 00013 * Does executing 00014 * 00015 * @return Status 00016 */ 00017 public function do_execute() { 00018 $ret = new Status(); 00019 $inst = $this->get_instance(); 00020 $new_status = $this->get_params(); 00021 if ($inst instanceof IStatusHolder) { 00022 if ($inst->get_status() != $new_status) { 00023 $inst->set_status($new_status); 00024 if ($inst instanceof DataObjectBase) { 00025 $ret->merge($inst->update()); 00026 } 00027 } 00028 } 00029 else { 00030 $ret->merge($this->illegal_data_error()); 00031 } 00032 return $ret; 00033 } 00034 }