Return the "where" portion of the SQL statement (without the where prefix)
@param Criteria $criteria the Criteria object to which this filter has been added
343711
public function GetWhere($criteria)
	{
		if ($this->Type != self::$TYPE_SEARCH) throw new Exception('Unsupported Filter Type');
		
		// normalize property names as an array
		$propertyNames = (is_array($this->PropertyNames)) ? $this->PropertyNames : explode(',', $this->PropertyNames);
		
		$where = ' (';
		$orDelim = '';
		foreach ($propertyNames as $propName)
		{
			$dbfield = $criteria->GetFieldFromProp($propName);
			$where .= $orDelim . $criteria->Escape($dbfield) ." like ". $criteria->GetQuotedSql($this->Value) . "";
			$orDelim = ' or ';
		}
		$where .= ') ';
		
		return $where;
	}
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;
    }
383155
protected function getCriteria(array $criteria = []): array
    {
        $criteria['source'] = $this->alias;
        $criteria['sourceTable'] = $this->sourceTable;
        $criteria['sourceField'] = $this->sourceField;

        return $criteria;
    }
334456
public function deleteBy($criteria)
    {
        $criteria = Util::normalizeCriteria($criteria);

        $queryBuilder = $this->getQueryBuilder($criteria);
        $queryBuilder->delete($this->entityName, 'e');
        $queryBuilder->getQuery()->execute();
    }
992700
final public static function where(array $criteria, array $orderBy = ['createdAt' => 'DESC'], int $limit = null, int $offset = null, bool $withTrash = false)
    {
        $criteria = self::criteriaWithSoftDelete($criteria, $withTrash);
        return static::getRepository()
            ->findBy($criteria, $orderBy, $limit, $offset);
    }
582097
protected function fetchCache($criteria)
    {
        $ser = serialize($criteria);

        if (isset($this->cache[$ser])) {
            return $this->cache[$ser];
        }
    }
85365
public function getFacetsByCriteria(Criteria $criteria)
    {
        $query = new Query();
        $query->setSize(0);

        $filter = $this->createFilterFromCriteria($criteria);

        $priorityFacet = new Facet\Terms('priorities');
        $priorityFacet->setField('priority');
        if ($filter->getFilters()) {
            $priorityFacet->setFilter($filter);
        }
        $query->addFacet($priorityFacet);

        $typeFacet = new Facet\Terms('types');
        $typeFacet->setField('type');
        if ($filter->getFilters()) {
            $typeFacet->setFilter($filter);
        }
        $query->addFacet($typeFacet);

        $channelFacet = new Facet\Terms('channels');
        $channelFacet->setField('channel');
        if ($filter->getFilters()) {
            $channelFacet->setFilter($filter);
        }
        $query->addFacet($channelFacet);

        $roleFacet = new Facet\Terms('roles');
        $roleFacet->setField('role');
        if ($filter->getFilters()) {
            $roleFacet->setFilter($filter);
        }
        $query->addFacet($roleFacet);

        $resultSet = $this->getType()->search($query);
        $facets = $resultSet->getFacets();

        $filterSets = [
            'priorities' => array_column($facets['priorities']['terms'], 'term'),
            'types' => array_column($facets['types']['terms'], 'term'),
            'channels' => array_column($facets['channels']['terms'], 'term'),
            'roles' => array_column($facets['roles']['terms'], 'term'),
        ];

        return $filterSets;
    }
284793
public function findOneBy($criteria)
    {
        if (in_array($criteria, [null, false], true)) {
            throw new BadArgumentException(sprintf('Method "%s" could not been invoked with empty criteria', __METHOD__));
        }
        
        return $this->findFirst($criteria);
    }
744365
public function findBy(array $criteria = [])
    {
        $data = $this->storage->findBy($this->schema, $this->typeSchema->name(), $criteria);

        if (count($data) === 0 || !array_key_exists('id', $data)) {
            return null;
        }

        return $this->hydrator->hydrate($this->typeSchema, $data);
    }
424069
public static function needsSelectAliases(Criteria $criteria)
    {
        $columnNames = array();
        foreach ($criteria->getSelectColumns() as $fullyQualifiedColumnName) {
            if ($pos = strrpos($fullyQualifiedColumnName, '.')) {
                $columnName = substr($fullyQualifiedColumnName, $pos);
                if (isset($columnNames[$columnName])) {
                    // more than one column with the same name, so aliasing is required
                    return true;
                }
                $columnNames[$columnName] = true;
            }
        }

        return false;
    }
678039
public function findOneBy(array $criteria)
    {
        $query = $this->createQueryBuilder($criteria);
        if (!($object = $this->getOneOrNullResultFromQueryBuilder($query))) {
            $this->throwException('The resource was not found', 'not-found');
        }
        return $object;
    }
1276803
public function GetCustomQuery($objectclass, $criteria)
	{
		$this->IncludeModel($objectclass);
		$sql = call_user_func( array($objectclass,"GetCustomQuery"),$criteria );
		return $sql;
	}
1030002
protected function getWhereCondition(string $field, array $criteria): array
    {
        $value = is_array($criteria['value']) ? $criteria['value'] : trim($criteria['value']);

        if ('' === $value) {
            return $this->getEmptyWhereCondition($field, $criteria);
        }

        $value = $this->handleMagicValue($value);
        $operator = $this->searchFields[$field]['operators'][$criteria['operator']];

        if (isset($operator['pattern'])) {
            $pattern = $operator['pattern'];
            $value = str_replace('{{value}}', $value, $pattern);
        }

        $type = 'string';
        if (! empty($this->searchFields[$field]['type']) &&
            array_key_exists($this->searchFields[$field]['type'], (array)Type::getMap())
        ) {
            $type = $this->searchFields[$field]['type'];
        }

        if (in_array($operator['operator'], ['IN', 'NOT IN'])) {
            $type .= '[]';
            $value = (array)$value;
        }

        if ($operator['operator'] === 'NOT IN') {
            return [ 'OR' => [ $field . ' IS NULL', new Comparison(new IdentifierExpression($field), $value, $type, $operator['operator']) ]];
        }

        return [ new Comparison(new IdentifierExpression($field), $value, $type, $operator['operator']) ];
    }
712741
protected function delete(array $criteria = array())
    {
        $conditions = array();
        
        foreach ($criteria as $field => $value) {
            $conditions[] = "$field = ?";
        }
        
        $sql = "DELETE FROM $this->_table WHERE " . implode(' AND ', $conditions);
        
        $pdos = $this->_pdo->prepare($sql);
        
        $pdos->execute(array_values($criteria));
        
        return $pdos->statement()->rowCount();
    }
329431
public function any(array $criteria) : self
    {
        $sql = [];
        $par = [];
        foreach ($criteria as $row) {
            if (isset($row[1])) {
                $temp = $this->filterSQL($row[0], $row[1] ?? null, $row[2] ?? false);
                $sql[] = $temp[0];
                $par = array_merge($par, $temp[1]);
            }
        }
        return $this->where('(' . implode(' OR ', $sql) . ')', $par);
    }
862534
public function getDeleteFromClause(Criteria $criteria, $tableName)
    {
        $sql = 'DELETE ';
        if ($queryComment = $criteria->getComment()) {
            $sql .= '/* ' . $queryComment . ' */ ';
        }

        if ($realTableName = $criteria->getTableForAlias($tableName)) {
            $realTableName = $criteria->quoteIdentifierTable($realTableName);
            $sql .= $tableName . ' FROM ' . $realTableName . ' AS ' . $tableName;
        } else {
            $tableName = $criteria->quoteIdentifierTable($tableName);
            $sql .= 'FROM ' . $tableName;
        }

        return $sql;
    }
702432
protected function getEmptyWhereCondition(string $field, array $criteria): array
    {
        $emptyCriteria = $this->searchFields[$field]['operators'][$criteria['operator']]['emptyCriteria'];

        $result = [];
        foreach ($emptyCriteria['values'] as $value) {
            $result[$emptyCriteria['aggregator']][] = $field . ' ' . trim($value);
        }

        return $result;
    }