35 public static function addRest($query, $n, \CRestServer $server)
39 $query = array_change_key_case($query, CASE_UPPER);
40 if (is_array($query[
'FIELDS']))
42 $fields = static::checkFields($query[
'FIELDS']);
45 $instance =
new static(static::getTargetEntityId());
47 return $instance->add($fields);
50 public static function updateRest($query, $n, \CRestServer $server)
52 $query = array_change_key_case($query, CASE_UPPER);
53 $id = (int) $query[
'ID'];
59 if (!static::checkAccessField($id))
65 if (is_array($query[
'FIELDS']))
67 $fields = static::checkFields($query[
'FIELDS']);
70 $instance =
new static(static::getTargetEntityId());
72 return $instance->update($id, $fields);
75 public static function deleteRest($query, $n, \CRestServer $server)
77 $query = array_change_key_case($query, CASE_UPPER);
78 $id = (int) $query[
'ID'];
84 if (!static::checkAccessField($id))
89 $instance =
new static(static::getTargetEntityId());
91 return $instance->delete($id);
94 public static function getListRest($query, $n, \CRestServer $server)
98 $query = array_change_key_case($query, CASE_UPPER);
99 if (is_array($query[
'ORDER']))
101 $order = $query[
'ORDER'];
103 if (is_array($query[
'FILTER']))
105 $filter = $query[
'FILTER'];
108 $instance =
new static(static::getTargetEntityId());
109 $result = $instance->getList($order, $filter);
111 if (is_array($result))
113 unset($result[
'total']);
114 foreach ($result as $key => $item)
116 if (mb_strpos($item[
'FIELD_NAME'], static::$nameFullPrefix) !== 0)
118 unset($result[$key]);
121 $result = array_values($result);
122 $result[
'total'] = count($result);