From 01b786480065408e74fab1b8b62cef01767782a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Egyed?= Date: Thu, 4 Jul 2024 08:55:43 +0200 Subject: [PATCH] Fix date time range filter data extraction (#24) --- Event/Subscriber/AbstractDoctrineSubscriber.php | 2 +- Filter/DataExtractor/FormDataExtractor.php | 2 +- Filter/DataExtractor/Method/ValueKeysExtractionMethod.php | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Event/Subscriber/AbstractDoctrineSubscriber.php b/Event/Subscriber/AbstractDoctrineSubscriber.php index a92faaf..6e160aa 100644 --- a/Event/Subscriber/AbstractDoctrineSubscriber.php +++ b/Event/Subscriber/AbstractDoctrineSubscriber.php @@ -147,7 +147,7 @@ public function filterDateTimeRange(GetFilterConditionEvent $event) $values = $event->getValues(); $value = $values['value']; - if (isset($value['left_datetime'][0]) || $value['right_datetime'][0]) { + if (isset($value['left_datetime'][0]) || isset($value['right_datetime'][0])) { $event->setCondition($expr->datetimeInRange($event->getField(), $value['left_datetime'][0], $value['right_datetime'][0])); } } diff --git a/Filter/DataExtractor/FormDataExtractor.php b/Filter/DataExtractor/FormDataExtractor.php index f1775f1..afebb7f 100644 --- a/Filter/DataExtractor/FormDataExtractor.php +++ b/Filter/DataExtractor/FormDataExtractor.php @@ -47,7 +47,7 @@ public function addMethod(DataExtractionMethodInterface $method) public function extractData(FormInterface $form, $methodName) { if (!isset($this->methods[$methodName])) { - throw new \RuntimeException(sprintf('Unknown extration method maned "%s".', $methodName)); + throw new \RuntimeException(sprintf('Unknown extraction method maned "%s".', $methodName)); } return $this->methods[$methodName]->extract($form); diff --git a/Filter/DataExtractor/Method/ValueKeysExtractionMethod.php b/Filter/DataExtractor/Method/ValueKeysExtractionMethod.php index ebfcbb6..5d74564 100644 --- a/Filter/DataExtractor/Method/ValueKeysExtractionMethod.php +++ b/Filter/DataExtractor/Method/ValueKeysExtractionMethod.php @@ -53,9 +53,6 @@ public function extract(FormInterface $form) $values['value'][$key][$k] = $v; } } - } else { - dump($keys, $data); - throw new \InvalidArgumentException(sprintf('No value found for key "%s" in form data.', $key)); } }