src/xPDO/Om/xPDOQuery.php
public function bindGraph($graph) {
        if (is_string($graph)) {
            $graph= $this->xpdo->fromJSON($graph);
        }
        if (is_array ($graph)) {
            if ($this->graph !== $graph) {
                $this->graph= $graph;
                $this->select($this->xpdo->getSelectColumns($this->_class, $this->_alias, $this->_alias . '_'));
                foreach ($this->graph as $relationAlias => $subRelations) {
                    $this->bindGraphNode($this->_class, $this->_alias, $relationAlias, $subRelations);
                }
                if ($pk= $this->xpdo->getPK($this->_class)) {
                    if (is_array ($pk)) {
                        foreach ($pk as $key) {
                            $this->sortby($this->xpdo->escape($this->_alias) . '.' . $this->xpdo->escape($key), 'ASC');
                        }
                    } else {
                        $this->sortby($this->xpdo->escape($this->_alias) . '.' . $this->xpdo->escape($pk), 'ASC');
                    }
                }
            }
        }
        return $this;
    }
public function bindGraph($graph) {
        if (is_string($graph)) {
            $graph= $this->xpdo->fromJSON($graph);
        }
        if (is_array ($graph)) {
            if ($this->graph !== $graph) {
                $this->graph= $graph;
                $this->select($this->xpdo->getSelectColumns($this->_class, $this->_alias, $this->_alias . '_'));
                foreach ($this->graph as $relationAlias => $subRelations) {
                    $this->bindGraphNode($this->_class, $this->_alias, $relationAlias, $subRelations);
                }
                if ($pk= $this->xpdo->getPK($this->_class)) {
                    if (is_array ($pk)) {
                        foreach ($pk as $key) {
                            $this->sortby($this->xpdo->escape($this->_alias) . '.' . $this->xpdo->escape($key), 'ASC');
                        }
                    } else {
                        $this->sortby($this->xpdo->escape($this->_alias) . '.' . $this->xpdo->escape($pk), 'ASC');
                    }
                }
            }
        }
        return $this;
    }
public function bindGraph ( $ graph ) { if ( is_string ( $ graph ) ) { $ graph = $ this -> xpdo -> fromJSON ( $ graph ) ; } if ( is_array ( $ graph ) ) { if ( $ this -> graph !== $ graph ) { $ this -> graph = $ graph ; $ this -> select ( $ this -> xpdo -> getSelectColumns ( $ this -> _class , $ this -> _alias , $ this -> _alias . '_' ) ) ; foreach ( $ this -> graph as $ relationAlias => $ subRelations ) { $ this -> bindGraphNode ( $ this -> _class , $ this -> _alias , $ relationAlias , $ subRelations ) ; } if ( $ pk = $ this -> xpdo -> getPK ( $ this -> _class ) ) { if ( is_array ( $ pk ) ) { foreach ( $ pk as $ key ) { $ this -> sortby ( $ this -> xpdo -> escape ( $ this -> _alias ) . '.' . $ this -> xpdo -> escape ( $ key ) , 'ASC' ) ; } } else { $ this -> sortby ( $ this -> xpdo -> escape ( $ this -> _alias ) . '.' . $ this -> xpdo -> escape ( $ pk ) , 'ASC' ) ; } } } } return $ this ; }
Bind an object graph to the query.

@param mixed $graph An array or JSON graph of related objects.
@return xPDOQuery Returns the instance.
Bind an object graph to the query .