* reports for a dataset * @param $datasetId * @return array * @throws Exception */
($datasetId, ?string $ownerId = null)
| 428 | * @throws Exception |
| 429 | */ |
| 430 | public function reportsForDataset($datasetId, ?string $ownerId = null) |
| 431 | { |
| 432 | $sql = $this->db->getQueryBuilder(); |
| 433 | $sql->from(self::TABLE_NAME) |
| 434 | ->select('id') |
| 435 | ->addSelect('name') |
| 436 | ->addSelect('user_id') |
| 437 | ->where($sql->expr()->eq('dataset', $sql->createNamedParameter($datasetId))); |
| 438 | if ($ownerId !== null) { |
| 439 | $sql->andWhere($sql->expr()->eq('user_id', $sql->createNamedParameter($ownerId))); |
| 440 | } |
| 441 | $statement = $sql->executeQuery(); |
| 442 | $result = $statement->fetchAll(); |
| 443 | $statement->closeCursor(); |
| 444 | return $result; |
| 445 | } |
| 446 | |
| 447 | /** |
| 448 | * increase version for all reports of a dataset |