public function combine($criterions = array(), $operator = self::LOGICAL_AND, $name = null)
    {
        $operatorMethod = (strtoupper($operator) == self::LOGICAL_AND) ? 'addAnd' : 'addOr';
        $namedCriterions = array();
        foreach ($criterions as $key) {
            if (array_key_exists($key, $this->namedCriterions)) {
                $namedCriterions[] = $this->namedCriterions[$key];
                unset($this->namedCriterions[$key]);
            } else {
                throw new PropelException('Cannot combine unknown condition ' . $key);
            }
        }
        $firstCriterion = array_shift($namedCriterions);
        foreach ($namedCriterions as $criterion) {
            $firstCriterion->$operatorMethod($criterion);
        }
        if ($name === null) {
            $this->addAnd($firstCriterion, null, null);
        } else {
            $this->addCond($name, $firstCriterion, null, null);
        }

        return $this;
    }
public function combine($criterions = array(), $operator = self::LOGICAL_AND, $name = null)
    {
        $operatorMethod = (strtoupper($operator) == self::LOGICAL_AND) ? 'addAnd' : 'addOr';
        $namedCriterions = array();
        foreach ($criterions as $key) {
            if (array_key_exists($key, $this->namedCriterions)) {
                $namedCriterions[] = $this->namedCriterions[$key];
                unset($this->namedCriterions[$key]);
            } else {
                throw new PropelException('Cannot combine unknown condition ' . $key);
            }
        }
        $firstCriterion = array_shift($namedCriterions);
        foreach ($namedCriterions as $criterion) {
            $firstCriterion->$operatorMethod($criterion);
        }
        if ($name === null) {
            $this->addAnd($firstCriterion, null, null);
        } else {
            $this->addCond($name, $firstCriterion, null, null);
        }

        return $this;
    }
public function combine ( $ criterions = array ( ) , $ operator = self :: LOGICAL_AND , $ name = null ) { $ operatorMethod = ( strtoupper ( $ operator ) == self :: LOGICAL_AND ) ? 'addAnd' : 'addOr' ; $ namedCriterions = array ( ) ; foreach ( $ criterions as $ key ) { if ( array_key_exists ( $ key , $ this -> namedCriterions ) ) { $ namedCriterions [ ] = $ this -> namedCriterions [ $ key ] ; unset ( $ this -> namedCriterions [ $ key ] ) ; } else { throw new PropelException ( 'Cannot combine unknown condition ' . $ key ) ; } } $ firstCriterion = array_shift ( $ namedCriterions ) ; foreach ( $ namedCriterions as $ criterion ) { $ firstCriterion -> $ operatorMethod ( $ criterion ) ; } if ( $ name === null ) { $ this -> addAnd ( $ firstCriterion , null , null ) ; } else { $ this -> addCond ( $ name , $ firstCriterion , null , null ) ; } return $ this ; }
Combine several named criterions with a logical operator

@param array  $criterions array of the name of the criterions to combine
@param string $operator   logical operator, either Criteria::LOGICAL_AND, or Criteria::LOGICAL_OR
@param string $name       optional name to combine the criterion later

@return Criteria

@throws PropelException
Combine several named criterions with a logical operator