@@ -175,7 +175,6 @@ private function getConditionFieldsType(string $className, string $typeName): In
175175 $ metadata = $ this ->entityManager ->getClassMetadata ($ className );
176176
177177 // Get custom operators
178- $ this ->customOperators = [];
179178 $ this ->readCustomOperatorsFromAnnotation ($ metadata ->reflClass );
180179
181180 // Get all scalar fields
@@ -294,24 +293,21 @@ private function getOperators(string $fieldName, LeafType $leafType, bool $isAss
294293 */
295294 private function readCustomOperatorsFromAnnotation (ReflectionClass $ class ): void
296295 {
297- $ filters = $ this ->getAnnotationReader ()->getClassAnnotation ($ class , Filters::class);
298- if ($ filters ) {
296+ $ allFilters = Utils::getRecursiveClassAnnotations ($ this ->getAnnotationReader (), $ class , Filters::class);
297+ $ this ->customOperators = [];
298+ foreach ($ allFilters as $ classWithAnnotation => $ filters ) {
299299
300300 /** @var Filter $filter */
301301 foreach ($ filters ->filters as $ filter ) {
302302 $ className = $ filter ->operator ;
303- $ this ->throwIfInvalidAnnotation ($ class , 'Filter ' , AbstractOperator::class, $ className );
303+ $ this ->throwIfInvalidAnnotation ($ classWithAnnotation , 'Filter ' , AbstractOperator::class, $ className );
304304
305305 if (!isset ($ this ->customOperators [$ filter ->field ])) {
306306 $ this ->customOperators [$ filter ->field ] = [];
307307 }
308308 $ this ->customOperators [$ filter ->field ][] = $ filter ;
309309 }
310310 }
311-
312- if ($ class ->getParentClass ()) {
313- $ this ->readCustomOperatorsFromAnnotation ($ class ->getParentClass ());
314- }
315311 }
316312
317313 /**
0 commit comments