File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/lib/Query/Image/CriterionVisitor Expand file tree Collapse file tree 1 file changed +13
-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,27 @@ abstract protected function getSearchFieldName(): string;
3132
3233 /**
3334 * @return array<string>
35+ *
36+ * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
3437 */
3538 protected function getSearchFieldNames (Criterion $ criterion ): array
3639 {
37- return array_keys (
40+ $ searchFieldNames = array_keys (
3841 $ this ->fieldNameResolver ->getFieldTypes (
3942 $ criterion ,
4043 $ criterion ->target ,
4144 $ this ->imageFieldType ->getFieldTypeIdentifier (),
4245 $ this ->getSearchFieldName ()
4346 )
4447 );
48+
49+ if (empty ($ searchFieldNames )) {
50+ throw new InvalidArgumentException (
51+ '$criterion->target ' ,
52+ "No searchable Fields found for the provided Criterion target ' {$ criterion ->target }'. "
53+ );
54+ }
55+
56+ return $ searchFieldNames ;
4557 }
4658}
You can’t perform that action at this time.
0 commit comments