Returns the SQL fragment needed to filter where a column equals a given value.

@param Collection $collection
@param Repository $repository
@param WhereExpressionCollector $whereExpressionCollector
@param array $params
@return string|void
344741
protected function doFilterWithRepository(
        Collection $collection,
        Repository $repository,
        WhereExpressionCollector $whereExpressionCollector,
        &$params
    ) {
        if ($this->isNumeric) {
            $equals = new MySqlEquals($this->columnName, $this->equalTo);
            return $equals->doFilterWithRepository($collection, $repository, $whereExpressionCollector, $params);
        }

        return true;
    }
35668
public function find(array $filter = [], array $orderBy = [], $limit = 0,
        $offset = 0, array $associate = []
    ) {
        try {

            $query = $this->query()
                ->select()
                ->associate($associate)
                ->setFilter($filter);

            foreach ($orderBy as $orderByRule) {
                $query->orderBy($orderByRule[0], $orderByRule[1]);
            }

            return $query->limit($limit)->offset($offset)->run($this->connection);
        } catch (Exception\QueryException $e) {
            throw new Exception\RepositoryException($e->getMessage());
        }
    }
252129
public function query(string $sql, array $params = []): Statement
    {
        $this->usedPrepare = false;
        $stmt = $this->prepare($sql, $params);
        $this->usedPrepare = true;
        $stmt->execute();
        return $stmt;
    }
243296
private function findRecords($repository, $pattern, $language = null)
    {
        $repoConfig = $this->repos[$repository];
        /** @var $q \Doctrine\ORM\QueryBuilder */
        $q = $this->doctrine
            ->getRepository($repoConfig['repository'])
            ->createQueryBuilder('i')
            ->setMaxResults(1500);
        $eb = $q->expr();
        $expr = $eb->orX();
        foreach ($repoConfig['fields'] as $fieldName) {
            $expr->add($eb->like($eb->lower('i.' . $fieldName), $eb->lower(':pattern')));
        }
        $q->where($expr);

        $params = array('pattern' => '%' . $pattern . '%');

        if (null !== $language) {
            $q->andWhere('i.language = :lang');
            $params[':lang'] = $language;
        }

        return $q->getQuery()->execute($params);
    }
1355749
public function whereEquals($column, $value, $filter = false)
    {
        return $this->where($column, '=', $value, $filter);
    }
1061443
private function getUpdateWhere($query, &$params)
    {
        $whereArray = [];

        if (isset($query['where'])) {
            $whereArray[] = '('.$query['where'].')';
            unset($query['where']);
        }

        foreach ($query as $field => $value) {
            if ($field[0] == ':') {
                $params[$field] = $value;
                continue;
            }
            $token = ':'.$field;
            $whereArray[] = "{$field} = {$token}";
            $params[$token] = $value;
        }

        return implode(' AND ', $whereArray);
    }
1099322
public function sqlExists(
		$from,
		$where = null,
		array $params = []
	) {
		$sql = $this->queryBuilder->buildExists($from, $where);
		$query = $this->database->prepare($sql);
		$query->execute($params);
		$this->addQuery($query->queryString, $params);
		return (boolean)$query->fetchColumn();
	}
1288454
public function query(string $sql, array $params = [])
    {
        $prepared = $this->prepare($sql, $params);
        $this->execute($prepared);
        return new ResultSet($prepared['statement']);
    }
394097
public function addWhere($where, $params = [], $operator = 'AND')
    {
        if ($where instanceof Criteria) {
            return $this->addCriteria($where);
        }
        if (null === $where) {
            return $this;
        }
        if (isset($this->query['where']) && !empty($this->query['where'])) {
            $operator = strtoupper($operator);
            $where = "({$this->query['where']}) {$operator} ({$where})";
        }
        $this->query['where'] = $where;
        $this->addParams($params);
        return $this;
    }
1297093
public function createCollectionTranslation(Collection $collection, string $locale): void
    {
        $query = $this->connection->createQueryBuilder()
            ->insert('ngbm_collection_translation')
            ->values(
                [
                    'collection_id' => ':collection_id',
                    'status' => ':status',
                    'locale' => ':locale',
                ]
            )
            ->setParameter('collection_id', $collection->id, Type::INTEGER)
            ->setParameter('status', $collection->status, Type::INTEGER)
            ->setParameter('locale', $locale, Type::STRING);

        $query->execute();
    }
521874
public function queryDocument($collection, $sql, array $params = [], array $options = [])
    {
        $this->setOptions($options);
        $doc = new Document($this->client, $this->database, $collection);
        $doc->setHeaders($this->getHeaders());
        $rs = $doc->query($sql, $params);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
562926
public function select($params/*, ...*/)
    {
        $rel = $this->currentOrClone();
        
        $params = func_get_args();
        if (is_array($params[0])) {
            $params = array_shift($params);
        }
        $rel->select->columns($params);
        return $rel;
    }
613543
private function mergeCollectionSqlSelectWithAnotherCollection(EntityRepository $collection): self
    {
        $select_fields = $collection->getSelectFields();
        foreach ($select_fields as $select_field) {
            $this->sql_select_fields[] = $select_field;
        }

        $where_fields = $collection->getWhereFields();
        foreach ($where_fields as $where_field) {
            $this->sql_where_fields[] = $where_field;
        }

        $group_fields = $collection->getGroupByField();
        foreach ($group_fields as $group_field) {
            $this->group_by_fields[] = $group_field;
        }

        $having_fields = $collection->getHavingFields();
        foreach ($having_fields as $having_field) {
            $this->having_fields[] = $having_field;
        }

        $order_fields = $collection->getOrderFields();
        foreach ($order_fields as $order_field) {
            $this->order_fields[] = $order_field;
        }

        $translation_fields = $collection->getTranslationFields();
        foreach ($translation_fields as $translation_field) {
            $this->translation_fields[] = $translation_field;
        }

        $join_tables = $collection->getJoinTables();
        foreach ($join_tables as $join_table) {
            $this->addJoinTable([$join_table['table'], $join_table['alias']], $join_table['left'], $join_table['right'], $join_table['type'], $join_table['right_table']);
        }

        return $this;
    }
967628
function where($expr)
    {
        $select = $this->from();
        foreach (func_get_args() as $expr) {
            $select->where($expr);
        }
        return $select;
    }
1199170
public function createCursorForCollection(RepositoryCollection $collection)
    {
        $params = [];

        $sqlStatement = $this->getSqlStatementForCollection($collection, $params);
        $hasLimit = $sqlStatement->hasLimit();

        $sql = (string)$sqlStatement;

        if ($hasLimit){
            $sql = preg_replace("/^SELECT /", "SELECT SQL_CALC_FOUND_ROWS ", $sql);
        }

        $connection = static::getReadOnlyConnection();
        $statement = static::executeStatement((string)$sql, $params, $connection);

        $count = $statement->rowCount();

        if ($hasLimit){
            $count = static::returnSingleValue("SELECT FOUND_ROWS()", [], $connection);
        }

        $cursor = new MySqlCursor($statement, $this, $count, $collection->additionalColumns);
        // If the number of groups in the statement match those demanded by the collection we can then
        // assume that all grouping has executed in the repository. If not then we set the flag accordingly
        // so that the Collection class can manually group the rows later.
        $cursor->grouped = count($collection->getGroups()) == count($sqlStatement->groups);


        $filter = $collection->getFilter();

        if ($filter){
            $cursor->filtered = $filter->wasFilteredByRepository();
        }

        $cursor->setHydrationMappings($sqlStatement->potentialHydrationMappings);

        return $cursor;
    }
1083077
public function ddl(Collection $collection)
    {
        if (!empty($this->options['autoddl'])) {
            $sql = $this->dialect->grammarDDL($collection, $this->options['autoddl']);

            $this->execute($sql);
        }
    }
1080740
public function bind($sql, array $params=array())
    {
        return $this->_bindInto('\?', $sql, $params, function($binder, $param) use ($sql) {
            return $binder->sqlValue($param);
        });
    }