Skip to content
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
11 changes: 5 additions & 6 deletions src/bundle/Controller/QueryFieldRestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use Ibexa\Contracts\Core\Repository\Values\Content\Location;
use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType;
use Ibexa\Contracts\Rest\Exceptions\NotFoundException;
use Ibexa\Contracts\Rest\UriParser\UriParserInterface;
use Ibexa\FieldTypeQuery\QueryFieldService;
use Ibexa\Rest\RequestParser;
use Ibexa\Rest\Server\Values as RestValues;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -34,21 +34,20 @@ final class QueryFieldRestController
/** @var \Ibexa\Contracts\Core\Repository\LocationService */
private $locationService;

/** @var \Ibexa\Rest\RequestParser */
private $requestParser;
private UriParserInterface $uriParser;

public function __construct(
QueryFieldService $queryFieldService,
ContentService $contentService,
ContentTypeService $contentTypeService,
LocationService $locationService,
RequestParser $requestParser
UriParserInterface $uriParser
) {
$this->queryFieldService = $queryFieldService;
$this->contentService = $contentService;
$this->contentTypeService = $contentTypeService;
$this->locationService = $locationService;
$this->requestParser = $requestParser;
$this->uriParser = $uriParser;
}

public function getResults(Request $request, $contentId, $versionNumber, $fieldDefinitionIdentifier): RestValues\ContentList
Expand Down Expand Up @@ -116,7 +115,7 @@ private function getContentType(ContentInfo $contentInfo): ContentType
*/
private function loadLocationByPath(Request $request): Location
{
$locationHrefParts = explode('/', $this->requestParser->parseHref($request->query->get('location'), 'locationPath'));
$locationHrefParts = explode('/', $this->uriParser->getAttributeFromUri($request->query->get('location'), 'locationPath'));
$locationId = array_pop($locationHrefParts);

return $this->locationService->loadLocation((int)$locationId);
Expand Down
4 changes: 1 addition & 3 deletions src/bundle/Resources/config/services/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ services:
autowire: true
public: true

Ibexa\Bundle\FieldTypeQuery\Controller\QueryFieldRestController:
arguments:
$requestParser: '@Ibexa\Bundle\Rest\RequestParser\Router'
Ibexa\Bundle\FieldTypeQuery\Controller\QueryFieldRestController: ~

Ibexa\FieldTypeQuery\QueryFieldService:
arguments:
Expand Down