public function setFilterTypes(array $allowedTypes) { $this->allowedFilterTypes = []; foreach ($allowedTypes as $index => $type) { if ($type instanceof Filter) { $filter = $type; } else { $filter = new Filter($type); if (!is_numeric($index)) { $filter->setField($index); } } $this->allowedFilterTypes[$filter->getName()] = $filter; } return $this; }