pairs = $set ? array_merge($set->pairs) : array(); } function add($value, $field, $quote=true) { if($value !=null) { if($value == ' ') $value = ''; array_push($this->pairs, $quote ? "$field = '$value'" : "$field = $value"); } return $this; } function addDate($date, $field) { return $this->add(date2sql($date), $field); } function addDatetime($date, $time, $field) { if(!$date) return $this; return $this->add(date2sql($date)." $time", $field); } function toString() { return implode(', ', $this->pairs); } } class OrderAction { public $detail_ids = array() ; public function __construct(array $data) { $this->detail_ids = array(); foreach($data['detail'] as $detail_id => $detail) { array_push($this->detail_ids, $detail_id); } } }