Timeline/TimelineBuilder.php
private function buildUnionQuery($context, array $args, $page, $number)
    {
        //throw an exception if no provider have been defined for this context
        if (!array_key_exists($context, $this->providers)) {
            throw new \LogicException(sprintf('No builders have been defined for "%s"'
                    . ' context', $context));
        }
        
        //append SELECT queries with UNION keyword between them
        $union = '';
        foreach($this->getProvidersByContext($context) as $provider) {  
            $select = $this->buildSelectQuery($provider, $context, $args); 
            $append = ($union === '') ?  $select : ' UNION '.$select;
            $union .= $append;
        }
        //add ORDER BY clause and LIMIT
        $union .= sprintf(' ORDER BY date DESC LIMIT %d OFFSET %d',
                $number, $page * $number);
        
        return $union;
    }
private function buildUnionQuery($context, array $args, $page, $number)
    {
        //throw an exception if no provider have been defined for this context
        if (!array_key_exists($context, $this->providers)) {
            throw new \LogicException(sprintf('No builders have been defined for "%s"'
                    . ' context', $context));
        }
        
        //append SELECT queries with UNION keyword between them
        $union = '';
        foreach($this->getProvidersByContext($context) as $provider) {  
            $select = $this->buildSelectQuery($provider, $context, $args); 
            $append = ($union === '') ?  $select : ' UNION '.$select;
            $union .= $append;
        }
        //add ORDER BY clause and LIMIT
        $union .= sprintf(' ORDER BY date DESC LIMIT %d OFFSET %d',
                $number, $page * $number);
        
        return $union;
    }
private function buildUnionQuery ( $ context , array $ args , $ page , $ number ) { //throw an exception if no provider have been defined for this context if ( ! array_key_exists ( $ context , $ this -> providers ) ) { throw new \ LogicException ( sprintf ( 'No builders have been defined for "%s"' . ' context' , $ context ) ) ; } //append SELECT queries with UNION keyword between them $ union = '' ; foreach ( $ this -> getProvidersByContext ( $ context ) as $ provider ) { $ select = $ this -> buildSelectQuery ( $ provider , $ context , $ args ) ; $ append = ( $ union === '' ) ? $ select : ' UNION ' . $ select ; $ union .= $ append ; } //add ORDER BY clause and LIMIT $ union .= sprintf ( ' ORDER BY date DESC LIMIT %d OFFSET %d' , $ number , $ page * $ number ) ; return $ union ; }
build the UNION query with all providers

@uses self::buildSelectQuery to build individual SELECT queries

@param string $context
@param mixed $args
@param int $page
@param int $number
@return string
@throws \LogicException if no builder have been defined for this context
build the UNION query with all providers