Skip to content

Commit bd4572b

Browse files
committed
add basic criterion visitor
1 parent f76a092 commit bd4572b

File tree

5 files changed

+23
-58
lines changed

5 files changed

+23
-58
lines changed

src/GraphQL/InputMapper/Search/Criterion/ContentTypeIdentifier.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/GraphQL/InputMapper/Search/Criterion/ParentLocationId.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/GraphQL/InputMapper/Search/Criterion/ContentTypeId.php renamed to src/GraphQL/InputMapper/Search/Criterion/Standard.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22

33
namespace EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion;
44

5-
use eZ\Publish\API\Repository\Values\Content\Query;
65
use EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\QueryBuilder;
76
use EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\QueryInputVisitor;
87

9-
class ContentTypeId implements QueryInputVisitor
8+
class Standard implements QueryInputVisitor
109
{
10+
private $criterionClass;
11+
12+
public function __construct($criterionClass)
13+
{
14+
$this->criterionClass = $criterionClass;
15+
}
16+
1117
public function visit(QueryBuilder $queryBuilder, $value): void
1218
{
13-
$queryBuilder->addCriterion(new Query\Criterion\ContentTypeId($value));
19+
$queryBuilder->addCriterion(new {$this->criterionClass}($value));
1420
}
1521
}

src/GraphQL/InputMapper/Search/Criterion/Text.php

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
services:
2-
EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\ContentTypeIdentifier:
3-
tags:
4-
- {name: 'ezplatform_graphql.query_input_visitor', inputKey: 'ContentTypeIdentifier'}
5-
62
EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\ContentTypeId:
3+
class: EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\Standard
4+
arguments:
5+
$criterionClass: 'eZ\Publish\API\Repository\Values\Content\Query\Criterion\ContentTypeId'
76
tags:
87
- {name: 'ezplatform_graphql.query_input_visitor', inputKey: 'ContentTypeId'}
98

109
EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\Text:
10+
class: EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\Standard
11+
arguments:
12+
$criterionClass: 'eZ\Publish\API\Repository\Values\Content\Query\Criterion\Fulltext'
1113
tags:
1214
- {name: 'ezplatform_graphql.query_input_visitor', inputKey: 'Text'}
1315

16+
EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\ParentLocationId:
17+
class: EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\Standard
18+
arguments:
19+
$criterionClass: 'eZ\Publish\API\Repository\Values\Content\Query\Criterion\ParentLocationId'
20+
tags:
21+
- {name: 'ezplatform_graphql.query_input_visitor', inputKey: 'ParentLocationId'}
22+
23+
1424
EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\Created:
1525
tags:
1626
- {name: 'ezplatform_graphql.query_input_visitor', inputKey: 'Created'}
@@ -23,10 +33,6 @@ services:
2333
tags:
2434
- {name: 'ezplatform_graphql.query_input_visitor', inputKey: 'Field'}
2535

26-
EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\Criterion\ParentLocationId:
27-
tags:
28-
- {name: 'ezplatform_graphql.query_input_visitor', inputKey: 'ParentLocationId'}
29-
3036
EzSystems\EzPlatformGraphQL\GraphQL\InputMapper\Search\SortBy:
3137
tags:
3238
- {name: 'ezplatform_graphql.query_input_visitor', inputKey: 'SortBy'}

0 commit comments

Comments
 (0)