src/League/Monga/Query/Where.php
public function setWhere(array $where)
    {
        // When the statement is empty set the
        // where property to null to prevent
        // empty statement errors.
        if (empty($where)) {
            // delete the current where statement
            $this->where = null;

            // Skip further execution
            return $this;
        }

        // Ensure the base $or clause
        if (! isset($where['$or'])) {
            // wrap the statement in an $or clause
            $where = ['$or' => [$where]];
        }

        // Fetch the last clause in the $or array
        // to allow further chaining it's required
        // to be wrapped in an @and statement.
        $lastClause = array_pop($where['$or']);

        if (! isset($lastClause['$and'])) {
            // Wrap in an @and statement
            $lastClause = ['$and' => [$lastClause]];
        }

        // Re-append the $and clause
        $where['$or'][] = $lastClause;

        // Replace the base where statement
        $this->where = $where;

        return $this;
    }
public function setWhere(array $where)
    {
        // When the statement is empty set the
        // where property to null to prevent
        // empty statement errors.
        if (empty($where)) {
            // delete the current where statement
            $this->where = null;

            // Skip further execution
            return $this;
        }

        // Ensure the base $or clause
        if (! isset($where['$or'])) {
            // wrap the statement in an $or clause
            $where = ['$or' => [$where]];
        }

        // Fetch the last clause in the $or array
        // to allow further chaining it's required
        // to be wrapped in an @and statement.
        $lastClause = array_pop($where['$or']);

        if (! isset($lastClause['$and'])) {
            // Wrap in an @and statement
            $lastClause = ['$and' => [$lastClause]];
        }

        // Re-append the $and clause
        $where['$or'][] = $lastClause;

        // Replace the base where statement
        $this->where = $where;

        return $this;
    }
public function setWhere ( array $ where ) { // When the statement is empty set the // where property to null to prevent // empty statement errors. if ( empty ( $ where ) ) { // delete the current where statement $ this -> where = null ; // Skip further execution return $ this ; } // Ensure the base $or clause if ( ! isset ( $ where [ '$or' ] ) ) { // wrap the statement in an $or clause $ where = [ '$or' => [ $ where ] ] ; } // Fetch the last clause in the $or array // to allow further chaining it's required // to be wrapped in an @and statement. $ lastClause = array_pop ( $ where [ '$or' ] ) ; if ( ! isset ( $ lastClause [ '$and' ] ) ) { // Wrap in an @and statement $ lastClause = [ '$and' => [ $ lastClause ] ] ; } // Re-append the $and clause $ where [ '$or' ] [ ] = $ lastClause ; // Replace the base where statement $ this -> where = $ where ; return $ this ; }
Replaces the where statement. The statement
will be reformatted to match, allowing further
chaining by Monga.

@param array $where An array of where conditions

@return object $this
Replaces the where statement . The statement will be reformatted to match allowing further chaining by Monga .