Returns a loader previously attached to the given filter.

@param string $filter

@throws \InvalidArgumentException

@return LoaderInterface
779347
public function getLoader($filter)
    {
        $config = $this->filterConfig->get($filter);

        $loaderName = empty($config['data_loader']) ? $this->defaultLoader : $config['data_loader'];

        if (!isset($this->loaders[$loaderName])) {
            throw new \InvalidArgumentException(sprintf(
                'Could not find data loader "%s" for "%s" filter type',
                $loaderName,
                $filter
            ));
        }

        return $this->loaders[$loaderName];
    }
342729
public function addLoader(string $filter, LoaderInterface $loader): void
    {
        $this->loaders[$filter] = $loader;
    }
1180644
public function addFilter($filter)
    {
        // Resolve filter object from string/object or throw Ex.
        $filterObj = FilterResolver::instance($filter);

        // If filtersOverride is allowed we will override filter
        // with same alias/name if there is one with new resolved filter.
        if ($this->getFiltersOverride()) {
            if ($key = array_search($filterObj->getName(), $this->getFilters())) {
                $this->filters[$key] = $filterObj;
            } else {
                $this->filters[$filterObj->getName()] = $filterObj;
            }
        } else {
            // If filtersOverride is disabled and we found
            // equal alias defined we will throw Ex.
            if (array_key_exists($filterObj->getName(), $this->getFilters())) {
                $ex = new FilterAlreadyBindedException($filterObj->getName(), $this->getName());
                throw $ex;
            }

            // Filter with resolvedFilter alias/name doesn't exist
            // so we will bind it as new one to field.
            $this->filters[$filterObj->getName()] = $filterObj;
        }

        return $this;
    }
1024937
protected function loadFilter($filter)
	{
		static $misses = [];

		if ( ! in_array($filter, $misses))
		{
			try
			{
				if ($obj = \Dependency::resolve('security.filter.'.strtolower($filter), array($this)))
				{
					$this->filters[strtolower($filter)] = $obj;

					return true;
				}
			}
			catch (\Fuel\Dependency\ResolveException $e)
			{
				// we don't have a class for this filter
				$misses[] = $filter;
			}
		}

		return false;
	}
144367
public function loadFromFile($pattern)
    {
        if (isset($this->files[$pattern])) {
            return $this;
        }

        $file = sprintf($pattern, $this->locale);
        if (!is_file($file)) {
            $defaultFile = sprintf($pattern, $this->defaultLocale);
            if (!is_file($defaultFile)) {
                throw new \InvalidArgumentException(sprintf('File "%s" and "%s" not found or not readable', $file, $defaultFile));
            } else {
                $file = $defaultFile;
            }
        }

        $this->files[$pattern] = true;

        return $this->loadFromArray(require $file);
    }
1127004
protected function getAnnouncementsFilter(string $filter = null)
    {
        $mappingConfiguration = new PropertyMappingConfiguration();
        $mappingConfiguration->setTypeConverter($this->typeConverterObjectConverter);
        $mappingConfiguration->setTypeConverterOption(\RGU\Dvoconnector\Property\TypeConverter\ObjectConverter::class, \RGU\Dvoconnector\Property\TypeConverter\ObjectConverter::CONFIGURATION_OBJECT, $this->getDefaultAnnouncementsFilter());

        return $this->convertAnnouncementsFilter($mappingConfiguration, $filter);
    }
738693
public function getLoader()
    {
        if (!($this->loader instanceof DictLoaderInterface)) {
            $dataDir = dirname(__DIR__).'/data/';

            $loaderName = $this->loader;
            $this->loader = new $loaderName($dataDir);
        }

        return $this->loader;
    }
38842
public function enable(string $name) : BsonFilter
    {
        if (! $this->has($name)) {
            throw new InvalidArgumentException("Filter '" . $name . "' does not exist.");
        }

        if (! $this->isEnabled($name)) {
            $filterClass      = $this->config->getFilterClassName($name);
            $filterParameters = $this->config->getFilterParameters($name);
            $filter           = new $filterClass($this->dm);

            foreach ($filterParameters as $param => $value) {
                $filter->setParameter($param, $value);
            }

            $this->enabledFilters[$name] = $filter;
        }

        return $this->enabledFilters[$name];
    }
249854
public function load($filter = NULL, array $options = NULL, $ttl = 0) {
		$this->reset();
		$this->_ttl=$ttl?:$this->rel_ttl;
		$res = $this->filteredFind($filter, $options, $ttl);
		if ($res) {
			$this->mapper->query = $res;
			$this->first();
		} else
			$this->mapper->reset();
		$this->emit('load');
		return $this->valid();
	}
728443
protected function getFilterConfiguration($filter)
    {
        if (!array_key_exists($filter, $this->mapping)) {
            throw new Exception($filter.' filter not found in assets mapping. Check your configuration');
        }
        $class = $this->mapping[$filter].'Configuration';

        if (!class_exists($class)) {
            throw new Exception($class.' filter configuration class not found');
        }
        $configuration = new $class();

        if (!($configuration instanceof ConfigurationInterface)) {
            throw new Exception(get_class($configuration).' should be an instance of '.ConfigurationInterface::class);
        }

        return $configuration;
    }
1324830
public function getLoader($type, $locale)
    {
        switch ($type) {
            case 'yaml':
                return $this->newLoaderYaml($locale);
            case 'php':
                return $this->newLoaderPHP($locale);
        }
        throw new \InvalidArgumentException("Unknown loader type '$type'.");
    }
1105437
public function performFilter($filter)
    {
        $filter = $this->getFilter($filter);

        if (!$filter) {
            throw new \Exception('Filter not found', 500);
        }

        if ($filter instanceof \Closure) {
            call_user_func($filter);
            return $this->setAppliedFilter($filter);
        }

        if (is_array($filter)) {
            list($class, $method) = $filter;
            if (!class_exists($class)) {
                throw new \Exception('Invalid filter class', 500);
            }

            $class = $this->app->make($class);
            call_user_func([$class, $method]);
            return $this->setAppliedFilter($filter);
        }

        throw new \Exception('Invalid filter', 500);
    }
895267
public function getParent($filter = null)
    {
        $parentID = $this->owner->ParentID;
        if (empty($parentID)) {
            return null;
        }
        $baseClass = $this->owner->baseClass();
        $idSQL = $this->owner->getSchema()->sqlColumnForField($baseClass, 'ID');
        return DataObject::get_one($baseClass, [
            [$idSQL => $parentID],
            $filter
        ]);
    }
952642
private static function fixFilterFieldPath(?Filter $filter): ? Filter
    {
        if (is_null($filter)) {
            return $filter;
        }

        $filterAsArray = $filter->toArray();
        $filterAsArray['field'] = Item::getPathByField($filterAsArray['field']);

        return Filter::createFromArray($filterAsArray);
    }
732805
public function provideFilter($filter = null)
    {
        if ($filter === null) {
            $filter = config('eloquentfilter.namespace', 'App\\ModelFilters\\').class_basename($this).'Filter';
        }

        return $filter;
    }
425292
public function filter($filter): ArrayObjectInterface
    {
        return \is_callable($filter, true) ? $this->filterCallback($filter) : $this->filterConditions($filter);
    }
1345549
public function filter($filter)
    {
        if (is_array($filter)) {
            $filter = new GridFilter($filter);
        }

        if ($filter instanceof FilterSpecification) {
            $filter = new GridFilter($filter->asFilter());
        }

        $this->filter = $filter;

        return $this;
    }