Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8800: Fixed subitems filtering #1328

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/bundle/Controller/Content/ContentTreeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Ibexa\Contracts\Core\Repository\Values\Content\Content;
use Ibexa\Contracts\Core\Repository\Values\Content\Location;
use Ibexa\Contracts\Core\Repository\Values\Content\Query;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Core\Repository\Values\User\Limitation;
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
use Ibexa\Rest\Message;
Expand Down Expand Up @@ -78,7 +79,7 @@ public function loadChildrenAction(
int $parentLocationId,
int $limit,
int $offset,
Query\Criterion $filter
?Criterion $filter
): Node {
$location = $this->locationService->loadLocation($parentLocationId);
$loadSubtreeRequestNode = new LoadSubtreeRequestNode($parentLocationId, $limit, $offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@ public function supports(Request $request, ArgumentMetadata $argument): bool
}

/**
* @return iterable<\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion>
* @return iterable<\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion|null>
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
*/
public function resolve(Request $request, ArgumentMetadata $argument): iterable
{
yield new LogicalAnd($this->processFilterQueryCriteria($request));
$criteria = $this->processFilterQueryCriteria($request);
if ($argument->isNullable() && empty($criteria)) {
yield null;

return;
}

yield new LogicalAnd($criteria);
}

/**
Expand Down
Loading