/** * Update item field/s indirect * @param array data * 1) 'param' => $value - indirect * 2) 'param1', 'param2' - directly from item */ function update_fields(array $data) { if (($t = array_keys($data)) && is_int($t[0])) { $bak = $data; $data = array(); foreach ($bak as $key) { $data[$key] = $this->get_data($key); } } $this->container->update_item_fields($this->id, $data); }
/** * Update item field/s indirect * @param array data * 1) 'param' => $value - indirect * 2) 'param1', 'param2' - directly from item */ function update_fields($data) { if (!is_array($data) && func_num_args() > 0) { $keys = func_get_args(); $data = array(); foreach ($keys as $v) { $data[$v] = $this->get_data($v); } } else { // array('field', ...) if (is_array($data) && isset($data[0])) { $keys = $data; $data = array(); foreach ($keys as $v) { $data[$v] = $this->get_data($v); } } } if ($this->is_dummy) { return; } $this->container->update_item_fields($this->id, $data); }