Skip to content

Commit 34f6fca

Browse files
committed
getSumsFromAbraFlexi now returns clean restult or empty array
1 parent bed4016 commit 34f6fca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/AbraFlexi/RO.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ public function getAllFromAbraFlexi($conditions = null, $indexBy = null)
18861886
public function getSumsFromAbraFlexi(
18871887
array $fields,
18881888
array $conditions = [],
1889-
) {
1889+
): array {
18901890
foreach ($fields as $field) {
18911891
if ($this->getColumnInfo($field)['inSummary'] === 'false') {
18921892
throw new \InvalidArgumentException(_('Column %s do not support summarization'));
@@ -1895,7 +1895,9 @@ public function getSumsFromAbraFlexi(
18951895

18961896
$conditions['fields'] = implode(',', array_unique($fields));
18971897

1898-
return $this->getFlexiData('$sum', $conditions);
1898+
$summaryRaw = $this->getFlexiData('$sum', $conditions);
1899+
1900+
return array_key_exists('sum', $summaryRaw) ? $summaryRaw['sum'] : [];
18991901
}
19001902

19011903
/**

0 commit comments

Comments
 (0)