@param string            $name
@param CriteriaInterface $criteria

@return NamedCriteriaCollectionInterface
166249
public function addNamedCriteria(string $name, CriteriaInterface $criteria): NamedCriteriaCollectionInterface
    {
        return $this->addNamedItem($name, $criteria);
    }
1080194
public function addCriterion(CriterionInterface $criterion, $name = null, $outerMode = Link::LINK_DEFAULT)
    {
        if (null !== $return = $this->validateMethodCall()) {
            return $return;
        }

        $criterionGroup = new CriterionGroup();
        $criterionGroup->addCriterion($criterion, $name);

        return $this->addCriterionGroup($criterionGroup, $name, $outerMode);
    }
1054022
public function find($criteria = null, $projection = null) {
        return new Cursor($this, $this->database->registerCriteriaFunction($criteria), $projection);
    }
569775
public function applyToCriteriaComparator(CriteriaComparator $criteriaComparator, CriteriaProperty $alias) {
		if ($this->targetComparatorConstraint === null) return;
		
		$critProp = CrIt::p($alias, $this->entityProperty);
		$subAlias = $criteriaComparator->endClause()->uniqueAlias();
		
		$subCriteria = new ComparatorCriteria();
		$subCriteria->select($subAlias)->from($this->targetEntityClass, $subAlias);
		
		$this->targetComparatorConstraint->applyToCriteriaComparator($subCriteria->where(), CrIt::p($subAlias));
		
		$criteriaComparator->match($critProp, 'CONTAINS ANY', $subCriteria);
	}
582097
protected function fetchCache($criteria)
    {
        $ser = serialize($criteria);

        if (isset($this->cache[$ser])) {
            return $this->cache[$ser];
        }
    }
477760
public function getCriteriaType($criteria) {
        $type = gettype($criteria);
        if ($type === 'object') {
            $type = get_class($criteria);
            if (!$criteria instanceof Om\xPDOCriteria) {
                $this->log(xPDO::LOG_LEVEL_WARN, "Invalid criteria object of class {$type} encountered.", '', __METHOD__, __FILE__, __LINE__);
                $type = null;
            } elseif ($criteria instanceof Om\xPDOQuery) {
                $type = 'xPDOQuery';
            } else {
                $type = 'xPDOCriteria';
            }
        }
        return $type;
    }
878226
private function _getCriteriaKeyList( MW_Common_Criteria_Interface $criteria, array $required )
	{
		$keys = array_merge( $required, $this->_getCriteriaKeys( $required, $criteria->getConditions() ) );

		foreach( $criteria->getSortations() as $sortation ) {
			$keys = array_merge( $keys, $this->_getCriteriaKeys( $required, $sortation ) );
		}

		$keys = array_unique( array_merge( $required, $keys ) );
		sort( $keys );

		return $keys;
	}
155920
public function getFirstChild(Criteria $criteria = null, ConnectionInterface $con = null)
    {
        if ($this->isLeaf()) {
            return null;
        } else {
            return ChildCategoryQuery::create(null, $criteria)
                ->childrenOf($this)
                ->orderByBranch()
                ->findOne($con);
        }
    }
705717
private function createCriteriaQueryBuilder(Criteria $criteria, $prefix)
    {
        $qb = $this->createQueryBuilder($prefix);

        if ($criteria->count()) {
            $composite = $this->applyCriteriaToQueryBuilder($criteria, $qb, $prefix);

            if ($composite->count()) {
                $qb->where($composite);
            }
        }

        return $qb;
    }
1282964
public function getPlainSelectedColumns(Criteria $criteria)
    {
        $selected = [];
        foreach ($criteria->getSelectColumns() as $columnName) {
            if (false === strpos($columnName, '(')) {
                $selected[] = $columnName;
            }
        }

        foreach ($criteria->getAsColumns() as $alias => $col) {
            if (false === strpos($col, '(') && !in_array($col, $selected)) {
                $selected[] = $col;
            }
        }

        return $selected;
    }
996425
public function getFacetsByCriteria(Criteria $criteria)
    {
        $qb = $this->createCriteriaQueryBuilder($criteria, 'm');

        $channelsQb = clone $qb;
        $channels = $channelsQb->select('DISTINCT m.channel')->getQuery()->getScalarResult();

        $typeQb = clone $qb;
        $types = $typeQb->select('DISTINCT m.type')->getQuery()->getScalarResult();

        $priorityQb = clone $qb;
        $priorities = $priorityQb->select('DISTINCT m.priority')->getQuery()->getScalarResult();

        $roleQb = clone $qb;
        $roles = $roleQb->select('DISTINCT m.role')->getQuery()->getScalarResult();

        return [
            'channels' => array_column($channels, 'channel'),
            'types' => array_column($types, 'type'),
            'priorities' => array_column($priorities, 'priority'),
            'roles' => array_column($roles, 'role'),
        ];
    }
602043
public function matching(Criteria $criteria)
    {
        $this->guardAgainstInvalidGivenType();
        $elements = $this->collection->matching($criteria)->toArray();

        return $this->create($elements);
    }
910037
public function init(ModelCriteria $criteria)
    {
        $this->dbName = $criteria->getDbName();
        $this->setClass($criteria->getModelName());
        $this->setWith($criteria->getWith());
        $this->asColumns = $criteria->getAsColumns();
        $this->hasLimit = $criteria->getLimit() != 0;

        return $this;
    }
468814
private function openCriteria(array &$criteria, $connector = self::LOGICAL_AND)
    {
        $criteria[] = array('bracket' => self::BRACKET_OPEN,
            'connector' => $connector);

        return $this;
    }
314419
public function query($name, QueryObjectInterface $queryObject, DisplayCriteriaInterface $displayCriteria = null)
    {
        $result = $this->doQuery($queryObject, $displayCriteria);
        $this->data[$name] = $result;

        return $result;
    }
128093
public function deleteCriterion($name)
    {
        $name = $this->resolveString($name, __METHOD__);

        if (false === $this->hasCriterion($name)) {
            throw new InvalidNameException(sprintf("The criterion '%s' doesn't exist in this group", $name));
        }

        unset($this->collection[$this->resolveString($name, __METHOD__)]);
        $this->collectionCount--;

        return $this;
    }
660264
public function mapLoadCriteriaToQuery(ILoadCriteria $criteria) : MappedLoadQuery
    {
        $select = $this->criteriaMapper->mapCriteriaToSelect($criteria, $memberMappings, $criteria->getAliasNestedMemberMap());
        $select->setColumns([]);

        $columnIndexMap  = [];
        $relationsToLoad = [];

        foreach ($criteria->getAliasNestedMemberMap() as $alias => $member) {
            /** @var MemberMappingWithTableAliases $memberMapping */
            $memberMapping = $memberMappings[$member->asString()];
            $mapping       = $memberMapping->getMapping();

            if ($mapping instanceof IFinalRelationMemberMapping) {
                $memberRelation   = $mapping->asMemberRelation();
                $parentTableAlias = $memberRelation instanceof ToManyMemberRelation || !($memberRelation->getFirstRelation() instanceof ISeparateTableRelation) || count($memberMapping->getTableAliases()) === 1
                    ? $memberMapping->getLastTableAlias()
                    : $memberMapping->getSecondLastTableAlias();
                $parentTable      = $select->getTableFromAlias($parentTableAlias);
                $parentColumnMap  = [];

                $parentColumnsToLoad = $memberRelation->getParentColumnsToLoad();

                if (!($mapping instanceof ToOneEmbeddedObjectMapping)) {
                    $parentColumnsToLoad[] = $parentTable->getPrimaryKeyColumnName();
                }

                foreach ($parentColumnsToLoad as $column) {
                    $parentColumnMap[$alias . '_' . $column] = $column;

                    $select->addColumn($alias . '_' . $column, Expr::column($parentTableAlias, $parentTable->getColumn($column)));
                }

                $relationsToLoad[$alias] = [$memberRelation, $parentTable, $parentColumnMap];
            } else {
                $mapping->addSelectColumn($select, $memberMapping->getLastTableAlias(), $alias);
                $columnIndexMap[$alias] = $alias;
            }
        }

        foreach ($memberMappings as $key => $memberMapping) {
            /** @var MemberMappingWithTableAliases $memberMapping */
            $memberMappings[$key] = $memberMapping->getMapping();
        }


        return new MappedLoadQuery($select, $columnIndexMap, $relationsToLoad);
    }