File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/Model/Search/Modifier/Filter/FieldType Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1414namespace Pimcore \Bundle \GenericDataIndexBundle \Model \Search \Modifier \Filter \FieldType ;
1515
1616use Pimcore \Bundle \GenericDataIndexBundle \Model \Search \Modifier \SearchModifierInterface ;
17+ use ValueError ;
1718
1819final readonly class MultiSelectFilter implements SearchModifierInterface
1920{
@@ -22,6 +23,7 @@ public function __construct(
2223 private array $ values ,
2324 private bool $ enablePqlFieldNameResolution = true ,
2425 ) {
26+ $ this ->validate ();
2527 }
2628
2729 public function getField (): string
@@ -38,4 +40,18 @@ public function isPqlFieldNameResolutionEnabled(): bool
3840 {
3941 return $ this ->enablePqlFieldNameResolution ;
4042 }
43+
44+ private function validate (): void
45+ {
46+ foreach ($ this ->values as $ value ) {
47+ if (!is_string ($ value ) && !is_int ($ value ) && !is_float ($ value )) {
48+ throw new ValueError (
49+ sprintf (
50+ 'Provided array must contain only string, int or float values. (%s given) ' ,
51+ gettype ($ value )
52+ ),
53+ );
54+ }
55+ }
56+ }
4157}
You can’t perform that action at this time.
0 commit comments