-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-5135: Added IsMainLocation criterion parser
- Loading branch information
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/lib/Server/Input/Parser/Criterion/Location/IsMainLocation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Rest\Server\Input\Parser\Criterion\Location; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\IsMainLocation as IsMainLocationCriterion; | ||
use Ibexa\Contracts\Rest\Exceptions; | ||
use Ibexa\Contracts\Rest\Input\ParsingDispatcher; | ||
use Ibexa\Rest\Input\BaseParser; | ||
|
||
final class IsMainLocation extends BaseParser | ||
{ | ||
public function parse(array $data, ParsingDispatcher $parsingDispatcher): IsMainLocationCriterion | ||
{ | ||
if (!array_key_exists('IsMainLocation', $data)) { | ||
throw new Exceptions\Parser('Invalid <IsMainLocation> format'); | ||
} | ||
|
||
return new IsMainLocationCriterion($data['IsMainLocation']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"ViewInput": { | ||
"identifier": "TitleView", | ||
"Query": { | ||
"LocationFilter": { | ||
"IsMainLocation": 1 | ||
}, | ||
"limit": 10, | ||
"offset": 0 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ViewInput> | ||
<identifier>TitleView</identifier> | ||
<Query> | ||
<LocationFilter> | ||
<IsMainLocation>1</IsMainLocation> | ||
</LocationFilter> | ||
<limit>10</limit> | ||
<offset>0</offset> | ||
</Query> | ||
</ViewInput> |