From 88c6a514eafe5cf298333b338756328fb6bb8c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Sat, 12 Oct 2024 12:47:42 +0200 Subject: [PATCH] Added criteria mappers for FieldValueCriterion, LogicalAnd and LogicalOr --- .../Resources/config/services/query.yaml | 12 +++++++++ .../FieldValueCriterionMapper.php | 26 +++++++++++++++++++ .../LogicalAndCriterionMapper.php | 26 +++++++++++++++++++ .../LogicalOrCriterionMapper.php | 26 +++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 src/lib/CriterionMapper/FieldValueCriterionMapper.php create mode 100644 src/lib/CriterionMapper/LogicalAndCriterionMapper.php create mode 100644 src/lib/CriterionMapper/LogicalOrCriterionMapper.php diff --git a/src/bundle/Resources/config/services/query.yaml b/src/bundle/Resources/config/services/query.yaml index f4f5313..ad6bcff 100644 --- a/src/bundle/Resources/config/services/query.yaml +++ b/src/bundle/Resources/config/services/query.yaml @@ -7,3 +7,15 @@ services: Ibexa\Contracts\CoreSearch\Values\Query\CriterionMapper: arguments: $mappers: !tagged_iterator ibexa.core_search.criterion_mapper + + Ibexa\CoreSearch\CriterionMapper\FieldValueCriterionMapper: + tags: + - { name: ibexa.core_search.criterion_mapper, priority: -100 } + + Ibexa\CoreSearch\CriterionMapper\LogicalAndCriterionMapper: + tags: + - { name: ibexa.core_search.criterion_mapper, priority: -100 } + + Ibexa\CoreSearch\CriterionMapper\LogicalOrCriterionMapper: + tags: + - { name: ibexa.core_search.criterion_mapper, priority: -100 } diff --git a/src/lib/CriterionMapper/FieldValueCriterionMapper.php b/src/lib/CriterionMapper/FieldValueCriterionMapper.php new file mode 100644 index 0000000..3b95865 --- /dev/null +++ b/src/lib/CriterionMapper/FieldValueCriterionMapper.php @@ -0,0 +1,26 @@ + + */ +final class FieldValueCriterionMapper extends AbstractFieldCriterionMapper +{ + public function canHandle(CriterionInterface $criterion): bool + { + return $criterion instanceof FieldValueCriterion; + } +} diff --git a/src/lib/CriterionMapper/LogicalAndCriterionMapper.php b/src/lib/CriterionMapper/LogicalAndCriterionMapper.php new file mode 100644 index 0000000..df7b5fc --- /dev/null +++ b/src/lib/CriterionMapper/LogicalAndCriterionMapper.php @@ -0,0 +1,26 @@ +