From 3c3a08f36918c84e9e9f9d318d0de9809e29c729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20St=C5=99=C3=ADbrn=C3=BD?= Date: Fri, 20 May 2016 16:33:43 +0200 Subject: [PATCH] fix: AggregateEntity - groupByPrefix: do not return FALSE on invalid value --- src/Components/AjaxSelect/Entities/AggregateEntity.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Components/AjaxSelect/Entities/AggregateEntity.php b/src/Components/AjaxSelect/Entities/AggregateEntity.php index 86d1e26..8f1150d 100644 --- a/src/Components/AjaxSelect/Entities/AggregateEntity.php +++ b/src/Components/AjaxSelect/Entities/AggregateEntity.php @@ -80,9 +80,9 @@ public function setOptions(array $options) { protected abstract function getGroupTitle($prefix); /** - * Groups values by known prefixes. + * Groups values by known prefixes, ignores unknown prefixes. * @param $value - * @return array|bool + * @return array */ protected function groupByPrefix($value) { if (!is_array($value)) { @@ -117,7 +117,6 @@ protected function groupByPrefix($value) { } // value has invalid prefix or no prefix at all -> it's invalid - return FALSE; } return $byPrefix; @@ -168,11 +167,6 @@ public function areValidValues(array $values) { $result = array_combine($values, array_fill(0, count($values), FALSE)); $byPrefix = $this->groupByPrefix($values); - if ($byPrefix === FALSE) { - // invalid prefix(es), sorry - return $result; - } - foreach ($byPrefix as $prefix => $nestedValues) { $entity = $this->entities[$prefix]; $areValid = $entity->areValidValues($nestedValues);