* get reports by group * @param $groupId * @return array * @throws Exception */
($groupId, string $ownerId)
| 392 | * @throws Exception |
| 393 | */ |
| 394 | public function getReportsByGroup($groupId, string $ownerId) |
| 395 | { |
| 396 | $sql = $this->db->getQueryBuilder(); |
| 397 | $sql->from(self::TABLE_NAME) |
| 398 | ->select('*') |
| 399 | ->where($sql->expr()->eq('parent', $sql->createNamedParameter($groupId))) |
| 400 | ->andWhere($sql->expr()->eq('user_id', $sql->createNamedParameter($ownerId))); |
| 401 | $statement = $sql->executeQuery(); |
| 402 | $result = $statement->fetchAll(); |
| 403 | $statement->closeCursor(); |
| 404 | |
| 405 | if ($result !== false && is_array($result)) { |
| 406 | foreach ($result as &$row) { |
| 407 | $row['dataset'] = (int) $row['dataset']; |
| 408 | $row['type'] = (int) $row['type']; |
| 409 | $row['parent'] = (int) $row['parent']; |
| 410 | } |
| 411 | unset($row); // Unset reference |
| 412 | } |
| 413 | |
| 414 | return $result; |
| 415 | } |
| 416 | |
| 417 | /** |
| 418 | * reports for a dataset |