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