Commit 8c2793dd authored by François Agneray's avatar François Agneray
Browse files

#23 => done

parent 4a81a602
......@@ -114,15 +114,6 @@ final class SearchDataAction
)->withStatus(404);
}
$queryParams = $request->getQueryParams();
if (!array_key_exists('c', $queryParams)) {
return $this->dispatchHttpError(
$response,
'Invalid request',
'Param c is required for this request'
)->withStatus(400);
}
$queryParams = $request->getQueryParams();
if (!array_key_exists('a', $queryParams)) {
return $this->dispatchHttpError(
......@@ -138,9 +129,11 @@ final class SearchDataAction
$queryBuilder = $connection->createQueryBuilder();
$anisQueryBuilder = $this->aqbf->create($queryBuilder, $dataset);
$anisQueryBuilder
->select(explode(';', $queryParams['a']))
->where(explode(';', $queryParams['c']));
$anisQueryBuilder->select(explode(';', $queryParams['a']));
if (array_key_exists('c', $queryParams)) {
$anisQueryBuilder->where(explode(';', $queryParams['c']));
}
if (array_key_exists('o', $queryParams)) {
$anisQueryBuilder->order(explode(';', $queryParams['o']));
......
......@@ -114,16 +114,7 @@ final class SearchMetaAction
'Dataset with id ' . $args['dname'] . ' is not found'
)->withStatus(404);
}
$queryParams = $request->getQueryParams();
if (!array_key_exists('c', $queryParams)) {
return $this->dispatchHttpError(
$response,
'Invalid request',
'Param c is required for this request'
)->withStatus(400);
}
$queryParams = $request->getQueryParams();
if (!array_key_exists('a', $queryParams)) {
return $this->dispatchHttpError(
......@@ -149,9 +140,11 @@ final class SearchMetaAction
$queryBuilder = $connection->createQueryBuilder();
$anisQueryBuilder = $this->aqbf->create($queryBuilder, $dataset);
$anisQueryBuilder
->count()
->where(explode(';', $queryParams['c']));
$anisQueryBuilder->count();
if (array_key_exists('c', $queryParams)) {
$anisQueryBuilder->where(explode(';', $queryParams['c']));
}
$this->logger->info('SQL: ' . $anisQueryBuilder->getSQL());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment