[TASK] Improve result handling for apis
This commit is contained in:
parent
f427ab7cd6
commit
cf387b1af7
@ -266,11 +266,26 @@ class AbstractEIDController
|
||||
protected function returnFunction(
|
||||
$result = []
|
||||
) {
|
||||
$result = $this->formatResult($result);
|
||||
$result = $this->formatResult($result, 'asd');
|
||||
unset($result['cid']);
|
||||
unset($result['componentMode']);
|
||||
unset($result['isValid']);
|
||||
return $result;
|
||||
if ($result) {
|
||||
if (!empty($this->errors)) {
|
||||
return $result;
|
||||
} else {
|
||||
return [
|
||||
'metadata' => [
|
||||
'total' => count($result),
|
||||
'count' => count($result),
|
||||
],
|
||||
'result' => $result,
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
//return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,8 +21,7 @@ trait FormatResultTrait
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function formatResult()
|
||||
{
|
||||
public function formatResult($result) {
|
||||
if ($result == null) {
|
||||
$result = [];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user