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