File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/lib/Query/Image/CriterionVisitor Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1010
1111use Ibexa \Contracts \Core \Repository \Values \Content \Query \Criterion ;
1212use Ibexa \Contracts \Solr \Query \CriterionVisitor ;
13+ use Ibexa \Core \Base \Exceptions \InvalidArgumentException ;
1314use Ibexa \Core \FieldType \Image \Type ;
1415use Ibexa \Core \Search \Common \FieldNameResolver ;
1516
@@ -31,16 +32,28 @@ abstract protected function getSearchFieldName(): string;
3132
3233 /**
3334 * @return array<string>
35+ *
36+ *
37+ * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
3438 */
3539 protected function getSearchFieldNames (Criterion $ criterion ): array
3640 {
37- return array_keys (
41+ $ searchFieldNames = array_keys (
3842 $ this ->fieldNameResolver ->getFieldTypes (
3943 $ criterion ,
4044 $ criterion ->target ,
4145 $ this ->imageFieldType ->getFieldTypeIdentifier (),
4246 $ this ->getSearchFieldName ()
4347 )
4448 );
49+
50+ if (empty ($ searchFieldNames )) {
51+ throw new InvalidArgumentException (
52+ '$criterion->target ' ,
53+ "No searchable Fields found for the provided Criterion target ' {$ criterion ->target }'. "
54+ );
55+ }
56+
57+ return $ searchFieldNames ;
4558 }
4659}
You can’t perform that action at this time.
0 commit comments