Skip to content

Commit

Permalink
Add "used" parameter for vocab members APIs
Browse files Browse the repository at this point in the history
(fix #1578, different implementation of the parameter part only of #1423)
  • Loading branch information
zerocrates committed Sep 15, 2020
1 parent 8d13af3 commit 8bb1b54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion application/src/Api/Adapter/PropertyAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public function buildQuery(QueryBuilder $qb, array $query)
$this->createNamedParameter($qb, $query['vocabulary_prefix']))
);
}

if (isset($query['local_name'])) {
$qb->andWhere($qb->expr()->eq(
"omeka_root.localName",
Expand All @@ -138,6 +137,13 @@ public function buildQuery(QueryBuilder $qb, array $query)
$this->createNamedParameter($qb, $localName))
);
}
if (!empty($query['used'])) {
$valuesAlias = $this->createAlias();
$qb->innerJoin(
'omeka_root.values',
$valuesAlias,
);
}
}

public function validateEntity(EntityInterface $entity, ErrorStore $errorStore)
Expand Down
7 changes: 7 additions & 0 deletions application/src/Api/Adapter/ResourceClassAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ public function buildQuery(QueryBuilder $qb, array $query)
$this->createNamedParameter($qb, $localName))
);
}
if (!empty($query['used'])) {
$valuesAlias = $this->createAlias();
$qb->innerJoin(
'omeka_root.resources',
$valuesAlias,
);
}
}

public function validateEntity(EntityInterface $entity, ErrorStore $errorStore)
Expand Down

0 comments on commit 8bb1b54

Please sign in to comment.