21 'TYPE'=>DataType::TYPE_INT,
27 'TYPE'=>DataType::TYPE_INT,
34 'TYPE'=>DataType::TYPE_INT,
41 'TYPE'=>DataType::TYPE_DATETIME,
47 'TYPE'=>DataType::TYPE_DATETIME,
53 'TYPE'=>DataType::TYPE_INT,
60 'TYPE'=>DataType::TYPE_STRING,
66 'TYPE'=>DataType::TYPE_STRING,
72 'TYPE'=>DataType::TYPE_STRING,
78 'TYPE'=>DataType::TYPE_FLOAT,
90 if(isset($arguments[
'fields']))
92 $fields = $arguments[
'fields'];
99 elseif ($name ==
'modify')
101 $fields = $arguments[
'fields'];
123 if($name ==
'upsert')
127 elseif ($name ==
'modify')
131 if($required->isSuccess() ===
false)
133 $r->addError(
new Error(implode(
', ', $required->getErrorMessages())));
148 if(!isset($fields[
'PROVIDER'][
'ID']))
150 $emptyFields[] =
'[provider][id]';
152 if(!isset($fields[
'STATISTICS']) || !is_array($fields[
'STATISTICS']))
154 $emptyFields[] =
'[statistics][]';
157 if(count($emptyFields)>0)
159 $r->addError(
new Error(
'Required fields: '.implode(
', ', $emptyFields)));
163 foreach ($fields[
'STATISTICS'] as $k=>$fields)
166 if($required->isSuccess() ===
false)
168 $r->addError(
new Error(
'[fields][statistics]['.$k.
'] - '.implode(
', ', $required->getErrorMessages()).
'.'));
178 if($name ==
'upsert')
180 $fields = $arguments[
'fields'];
186 elseif ($name ==
'modify')
188 $fields = $arguments[
'fields'];
193 parent::internalizeArguments($name, $arguments);
203 $result[
'PROVIDER'][
'ID'] = (int)$fields[
'PROVIDER'][
'ID'];
205 foreach ($fields[
'STATISTICS'] as $k=>$statistic)
215 if($name ==
'upsert')
219 elseif ($name ==
'modify')
226 parent::externalizeResult($name, $fields);
internalizeFieldsAdd($fields, $fieldsInfo=[])
externalizeFieldsGet($fields, $fieldsInfo=[])
convertKeysToSnakeCaseFields($fields)
internalizeArguments($name, $arguments)
checkFieldsModify($fields)
convertKeysToSnakeCaseFieldsModify($fields)
convertKeysToSnakeCaseArguments($name, $arguments)
checkArguments($name, $arguments)
externalizeResult($name, $fields)
internalizeFieldsModify($fields)