ModelBundle/Repository/RepositoryTrait/KeywordableTrait.php
public function transformConditionToMongoCondition($condition, $count = 0, array $aliases = array(), $delimiter = '##')
    {
        if (!is_null($condition)) {
            $encapsuledElements = array();
            preg_match_all(KeywordableTraitInterface::GET_BALANCED_BRACKETS, $condition, $encapsuledElements);
            foreach ($encapsuledElements[0] as $key => $encapsuledElement) {
                $alias = $delimiter.$count.$delimiter;
                $condition = preg_replace('/'.preg_quote($encapsuledElement).'/', $alias, $condition, 1);
                $aliases[$alias] = $this->transformSubConditionToMongoCondition($encapsuledElements[1][$key], $aliases);
                $count++;
            }
            if (count($encapsuledElements[0]) > 0) {
                $result = $this->transformConditionToMongoCondition($condition, $count, $aliases, $delimiter);
            } else {
                $result = $this->transformSubConditionToMongoCondition($condition, $aliases);
            }
        } else {
            $result = null;
        }

        return $result;
    }
public function transformConditionToMongoCondition($condition, $count = 0, array $aliases = array(), $delimiter = '##')
    {
        if (!is_null($condition)) {
            $encapsuledElements = array();
            preg_match_all(KeywordableTraitInterface::GET_BALANCED_BRACKETS, $condition, $encapsuledElements);
            foreach ($encapsuledElements[0] as $key => $encapsuledElement) {
                $alias = $delimiter.$count.$delimiter;
                $condition = preg_replace('/'.preg_quote($encapsuledElement).'/', $alias, $condition, 1);
                $aliases[$alias] = $this->transformSubConditionToMongoCondition($encapsuledElements[1][$key], $aliases);
                $count++;
            }
            if (count($encapsuledElements[0]) > 0) {
                $result = $this->transformConditionToMongoCondition($condition, $count, $aliases, $delimiter);
            } else {
                $result = $this->transformSubConditionToMongoCondition($condition, $aliases);
            }
        } else {
            $result = null;
        }

        return $result;
    }
public function transformConditionToMongoCondition ( $ condition , $ count = 0 , array $ aliases = array ( ) , $ delimiter = '##' ) { if ( ! is_null ( $ condition ) ) { $ encapsuledElements = array ( ) ; preg_match_all ( KeywordableTraitInterface :: GET_BALANCED_BRACKETS , $ condition , $ encapsuledElements ) ; foreach ( $ encapsuledElements [ 0 ] as $ key => $ encapsuledElement ) { $ alias = $ delimiter . $ count . $ delimiter ; $ condition = preg_replace ( '/' . preg_quote ( $ encapsuledElement ) . '/' , $ alias , $ condition , 1 ) ; $ aliases [ $ alias ] = $ this -> transformSubConditionToMongoCondition ( $ encapsuledElements [ 1 ] [ $ key ] , $ aliases ) ; $ count ++ ; } if ( count ( $ encapsuledElements [ 0 ] ) > 0 ) { $ result = $ this -> transformConditionToMongoCondition ( $ condition , $ count , $ aliases , $ delimiter ) ; } else { $ result = $ this -> transformSubConditionToMongoCondition ( $ condition , $ aliases ) ; } } else { $ result = null ; } return $ result ; }
@param string $condition
@param int    $count
@param array  $aliases
@param string $delimiter

@return array|null
@param string $condition @param int $count @param array $aliases @param string $delimiter