Get all objects

@param string $classname
@param string|integer $filter Filter name or id (advanced filters)
@param AbstractModel $parent
@return ArrayObject
@throws InvalidFilterException
506883
public function getAll($classname, $filter = null, AbstractModel $parent = null)
    {
        $filterUrl = '';
        if (!is_null($filter)) {
            if (
                isset($this->filters[$classname]) &&
                in_array($filter, $this->filters[$classname])) {

                $filterUrl = '/filter/' . $filter;
            } elseif (
                isset($this->filters[$classname]) &&
                preg_match('/^[0-9]+$/D', $filter)) {

                $filterUrl = '/filter/' . $filter;
            } else {
                $message = 'Unknown filter "' . $filter . '" for ' . $classname;
                if (isset($this->filters[$classname])) {
                    $message .= '; available filters: ' . implode(', ', $this->filters[$classname]);
                }
                throw new InvalidFilterException($message);
            }
        }

        $response = $this->request($this->buildUrl(new $classname(), $parent, $filterUrl), 'GET');
        return $this->mapper->mapFromStorage($response);
    }
245731
static function fetchAllClasses( $asObject = true, $includeFilter = true, $groupList = false )
    {
        $filterTableSQL = '';
        $filterSQL = '';
        if ( is_array( $groupList ) )
        {
            $filterTableSQL = ', ezcontentclass_classgroup ccg';
            $filterSQL = ( " AND" .
                           "      cc.id = ccg.contentclass_id AND" .
                           "      ccg.group_id " );
            $groupText = implode( ', ', $groupList );
            if ( $includeFilter )
                $filterSQL .= "IN ( $groupText )";
            else
                $filterSQL .= "NOT IN ( $groupText )";
        }

        $classNameFilter = eZContentClassName::sqlFilter( 'cc' );

        $classList = array();
        $db = eZDB::instance();
        // If $asObject is true we fetch all fields in class
        $fields = $asObject ? "cc.*" : "cc.id, $classNameFilter[nameField]";
        $rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
                                 "FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
                                 "WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . "$filterSQL AND $classNameFilter[where]" .
                                 "ORDER BY $classNameFilter[nameField] ASC" );

        $classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
        return $classList;
    }
336671
public function addFilter($filter)
    {
        if (!$filter instanceof FilterInterface) {
            if (!is_callable($filter)) {
                throw new \InvalidArgumentException('Filter should be callable or ' . FilterInterface::class);
            }

            $filter = new CallbackFilter($filter);
        }

        $this->filters[] = $filter;

        return $this;
    }
620668
public function getMethods($filter = null)
    {
        if ($this->methods === null) {
            // lazy load class methods list
            $this->methods = array();
            foreach ($this->node->stmts as $stmt) {
                if ($stmt instanceof Node\Stmt\ClassMethod) {
                    $stmt->setAttribute('fileName', $this->getFileName());
                    $this->methods[$stmt->name] = new MethodModel($this, $stmt);
                }
            }
        }

        if (isset($filter)) {
            // @TODO must implement the filter feature
            $methods =& $this->methods;
        } else {
            $methods =& $this->methods;
        }

        return array_values($methods);
    }
1090442
public function parseFilter($filter, $model)
    {
        $this->guardProviderNames(null, $model);

        $applied = [
            'operation' => $filter['operation'],
        ];

        if (isset($filter['local'])) {
            $applied['property'] = $filter['local'];
        }

        if (isset($filter['remote'])) {
            $applied['value'] = $model->getProperty($filter['remote']);
        }

        if (isset($filter['remote_value'])) {
            $applied['value'] = $filter['remote_value'];
        }

        if (isset($filter['value'])) {
            $applied['value'] = $filter['value'];
        }

        if (isset($filter['children'])) {
            foreach ($filter['children'] as $child) {
                $applied['children'][] = $this->parseFilter($child, $model);
            }
        }

        return $applied;
    }
17305
private function instantiateFilter(Context $context, $className) {
		if($context->view->getFilterFactory()) {
					return $context->view->getFilterFactory()->create($className);
		}

		$reflection = new \ReflectionClass($className);
		$instance = $reflection->newInstance();
		if (! $instance instanceof Filter) {
		    throw new RenderingException($this->getTagName(),
                $context->getFilename(),
                $this->getLineNumber(),
                'Class ' . get_class($instance) . ' is not a Filter.');
        }
        return $instance;
	}
395316
public function getOrphanedPages($class = SiteTree::class, $filter = array(), $sort = null, $join = null, $limit = null)
    {
        // Alter condition
        $table = DataObject::getSchema()->tableName($class);
        if (empty($filter)) {
            $where = array();
        } elseif (is_array($filter)) {
            $where = $filter;
        } else {
            $where = array($filter);
        }
        $where[] = array("\"{$table}\".\"ParentID\" != ?" => 0);
        $where[] = '"Parents"."ID" IS NULL';

        $orphans = new ArrayList();
        foreach (array(Versioned::DRAFT, Versioned::LIVE) as $stage) {
            $table .= ($stage == Versioned::LIVE) ? '_Live' : '';
            $stageOrphans = Versioned::get_by_stage(
                $class,
                $stage,
                $where,
                $sort,
                null,
                $limit
            )->leftJoin($table, "\"$table\".\"ParentID\" = \"Parents\".\"ID\"", "Parents");
            $orphans->merge($stageOrphans);
        }

        $orphans->removeDuplicates();

        return $orphans;
    }
586254
public function getChildren (ContextSpecificationInterface $filter = null)
	{
		if ($filter === null)
		{
			return $this->children;
		}
		else
		{
			return array_filter ($this->children, [$filter, 'isSatisfiedBy']);
		}
	}
69383
public function fetchAll($namespace, $filter = [], $options = [], $secondaryPreferred = true)
    {
        if (is_bool($secondaryPreferred)) {
            $readPreference = new ReadPreference($secondaryPreferred ? ReadPreference::RP_SECONDARY_PREFERRED : ReadPreference::RP_PRIMARY);
        } else {
            $readPreference = new ReadPreference($secondaryPreferred);
        }
        try {
            $result = $this->_fetchAll($namespace, $filter, $options, $readPreference);
        } catch (\Exception $exception) {
            $result = null;
            $failed = true;
            if (!$this->_ping()) {
                try {
                    $this->close();
                    $result = $this->_fetchAll($namespace, $filter, $options, $readPreference);
                    $failed = false;
                } catch (\Exception $exception) {
                }
            }

            if ($failed) {
                throw new MongodbException($exception->getMessage(), $exception->getCode(), $exception);
            }
        }

        return $result;
    }
350602
protected function getProperties(\ReflectionClass $originalClass, $filter = null)
    {
        return array_filter(
            $originalClass->getProperties($filter),
            function (\ReflectionProperty $property) {
                return ! $property->isStatic();
            }
        );
    }
662086
public function getFilterCollection(): FilterCollection
    {
        if ($this->filters === null) {
            $this->filters = new FilterCollection();
        }
        return $this->filters;
    }
881225
public function actionFilter($filterName, $query = null)
    {
        $this->checkAccess('filter');
        
        $model = $this->model;
        
        $filterName = Html::encode($filterName);
        
        if (!array_key_exists($filterName, $model->ngRestFilters())) {
            throw new InvalidCallException("The requested filter '$filterName' does not exists in the filter list.");
        }

        $find = $model->ngRestFilters()[$filterName];

        if ($query) {
            foreach ($model->getNgRestPrimaryKey() as $pkName) {
                $searchQuery = $model->ngRestFullQuerySearch($query)->select([$model->tableName() . '.' . $pkName]);
                $find->andWhere(['in', $model->tableName() . '.' . $pkName, $searchQuery]);
            }
        }

        $this->appendPoolWhereCondition($find);
        
        return new ActiveDataProvider([
            'query' => $find,
            'pagination' => $this->pagination,
            'sort' => [
                'attributes' => $this->generateSortAttributes($model->getNgRestConfig()),
            ]
        ]);
    }
1209254
public function filter($filter)
    {
        if (!is_a($filter, FilterBuilder::class)) {
            throw new \Exception ("Filter must be extend class 'FilterBuilder'");
        }

        $this->filter = $filter;

        return $this;
    }
872648
public function filter(string $name, AbstractQuery $filter = null): Filter
    {
        return new Filter($name, $filter);
    }
168886
public static function getCategoryFilterValues($filter, $categoryId) {
        /* @var $class ActiveRecordInterface */

        $class = $filter->type->class_name;
        $objects = $class::find()
            ->joinWith('products p')
            ->where(['p.category_id' => $categoryId])
            ->all();

        return $objects;
    }
644613
public static function getKeys($filter = []): array
    {
        /* @var $class LightModel */
        $className = get_called_class();
        $class = new $className;
        $tableKey = $class->getKeyName();

        $sql = 'SELECT ' . $tableKey . ' FROM ' . $class->getTableName() . ' WHERE 1=1';
        $params = self::handleFilter($sql, $filter, $class);

        $query = DB::getConnection()->prepare($sql);
        $query->execute($params);

        $res = [];

        foreach ($query->fetchAll() as $key => $value)
        {
            $res[] = $value[0];
        }

        return $res;
    }
986685
public function getByKey($key, \chilimatic\lib\datastructure\graph\filter\AbstractFilter $filter = null)
    {
        return $this->children->getByKey($key, $filter);
    }