Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Search/ExpressionLanguage/MassiveSearchExpressionLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;

/**
* Expression language for massive search bundle.
Expand Down Expand Up @@ -104,9 +105,15 @@ function($elements, $expression) {
throw new \Exception('Value function does not support compilation');
},
function(array $values, $propertyPath, $default = null) use ($accessor) {
$value = $accessor->getValue($values, $propertyPath);
if (null !== $value) {
return $value;
try {
$value = $accessor->getValue($values, $propertyPath);
if (null !== $value) {
return $value;
}
} catch (NoSuchIndexException $e) {
// settings can be stdClass as it needs to convert to {} instead of [] for frontend
// currently NoSuchIndexException will be thrown which we need to catch here and
// return the default value
}

return $default;
Expand Down