[COMPONENT][Collection] Only run queries if the criteria is not empty

This commit is contained in:
Hugo Sales 2022-01-08 15:17:13 +00:00
parent da6d3bd351
commit 06ece5b72e
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 2 additions and 2 deletions

View File

@ -40,13 +40,13 @@ class Collection extends Component
$actors = [];
if (!\is_null($note_criteria)) {
$note_qb->addCriteria($note_criteria);
$notes = $note_qb->getQuery()->execute();
}
$notes = $note_qb->getQuery()->execute();
if (!\is_null($actor_criteria)) {
$actor_qb->addCriteria($actor_criteria);
$actors = $actor_qb->getQuery()->execute();
}
$actors = $actor_qb->getQuery()->execute();
// N.B.: Scope is only enforced at FeedController level
return ['notes' => $notes ?? null, 'actors' => $actors ?? null];