Skip to content

Commit

Permalink
IBX-8535: Dropped deprecated REST related code (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou authored Sep 27, 2024
1 parent 941bb2d commit cfc6043
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
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

0 comments on commit cfc6043

Please sign in to comment.