Skip to content

Commit

Permalink
fix: AggregateEntity - groupByPrefix: do not return FALSE on invalid …
Browse files Browse the repository at this point in the history
…value
  • Loading branch information
Daniel Stříbrný committed May 20, 2016
1 parent b5175c7 commit 3c3a08f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Components/AjaxSelect/Entities/AggregateEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -117,7 +117,6 @@ protected function groupByPrefix($value) {
}

// value has invalid prefix or no prefix at all -> it's invalid
return FALSE;
}

return $byPrefix;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3c3a08f

Please sign in to comment.