protected function _links($query, $links)
    {
        settype($links, 'array');

        foreach ($links as $link) {
            $resource = $link['resource'];
            $description = $link['query']->getRepository()->getDescription();
            $conditions = array();

            foreach ($link['conditions'] as $key => $value) {
                if (is_numeric($key)) {
                    $conditions[] = $value;
                } elseif ($value instanceof AnDomainResourceColumn) {
                    $conditions[] = $key.' = '.(string) $value;
                } else {
                    $conditions[] = $key.' = '.$this->_store->quoteValue($value);
                }
            }

            if ($link['bind_type']) {
                $type = $this->_inheritanceTree($description);
                if (!empty($type) && $type != '%') {
                    $operator = substr($this->_inheritanceTree($description), -1) == '%' ? 'LIKE' : '=';
                    $conditions[] = $link['bind_type']. ' ' . $operator . ' \'' .$this->_inheritanceTree($description).'\'';
                }
            }

            $name = $this->_store->quoteName($link['resource_name']);
            $type = strtoupper($link['type']);
            switch ($type) {
                case 'STRONG' : $type = 'INNER';break;
                case 'WEAK'   : $type = 'LEFT';break;
            }
            //$name    = $this->_store->quoteName($resource->getName());
            $query->join($type, $resource->getName().' AS '.$name, $conditions);

            $this->_links($query, $link->query->link);
        }
    }
protected function _links($query, $links)
    {
        settype($links, 'array');

        foreach ($links as $link) {
            $resource = $link['resource'];
            $description = $link['query']->getRepository()->getDescription();
            $conditions = array();

            foreach ($link['conditions'] as $key => $value) {
                if (is_numeric($key)) {
                    $conditions[] = $value;
                } elseif ($value instanceof AnDomainResourceColumn) {
                    $conditions[] = $key.' = '.(string) $value;
                } else {
                    $conditions[] = $key.' = '.$this->_store->quoteValue($value);
                }
            }

            if ($link['bind_type']) {
                $type = $this->_inheritanceTree($description);
                if (!empty($type) && $type != '%') {
                    $operator = substr($this->_inheritanceTree($description), -1) == '%' ? 'LIKE' : '=';
                    $conditions[] = $link['bind_type']. ' ' . $operator . ' \'' .$this->_inheritanceTree($description).'\'';
                }
            }

            $name = $this->_store->quoteName($link['resource_name']);
            $type = strtoupper($link['type']);
            switch ($type) {
                case 'STRONG' : $type = 'INNER';break;
                case 'WEAK'   : $type = 'LEFT';break;
            }
            //$name    = $this->_store->quoteName($resource->getName());
            $query->join($type, $resource->getName().' AS '.$name, $conditions);

            $this->_links($query, $link->query->link);
        }
    }
protected function _links ( $ query , $ links ) { settype ( $ links , 'array' ) ; foreach ( $ links as $ link ) { $ resource = $ link [ 'resource' ] ; $ description = $ link [ 'query' ] -> getRepository ( ) -> getDescription ( ) ; $ conditions = array ( ) ; foreach ( $ link [ 'conditions' ] as $ key => $ value ) { if ( is_numeric ( $ key ) ) { $ conditions [ ] = $ value ; } elseif ( $ value instanceof AnDomainResourceColumn ) { $ conditions [ ] = $ key . ' = ' . ( string ) $ value ; } else { $ conditions [ ] = $ key . ' = ' . $ this -> _store -> quoteValue ( $ value ) ; } } if ( $ link [ 'bind_type' ] ) { $ type = $ this -> _inheritanceTree ( $ description ) ; if ( ! empty ( $ type ) && $ type != '%' ) { $ operator = substr ( $ this -> _inheritanceTree ( $ description ) , - 1 ) == '%' ? 'LIKE' : '=' ; $ conditions [ ] = $ link [ 'bind_type' ] . ' ' . $ operator . ' \'' . $ this -> _inheritanceTree ( $ description ) . '\'' ; } } $ name = $ this -> _store -> quoteName ( $ link [ 'resource_name' ] ) ; $ type = strtoupper ( $ link [ 'type' ] ) ; switch ( $ type ) { case 'STRONG' : $ type = 'INNER' ; break ; case 'WEAK' : $ type = 'LEFT' ; break ; } //$name    = $this->_store->quoteName($resource->getName()); $ query -> join ( $ type , $ resource -> getName ( ) . ' AS ' . $ name , $ conditions ) ; $ this -> _links ( $ query , $ link -> query -> link ) ; } }
Recursively adds a the links to the query.

@param AnDomainQuery $query Query object
@param array
Recursively adds a the links to the query .