src/xPDO/Om/xPDOQuery.php
public function bindGraphNode($parentClass, $parentAlias, $classAlias, $relations) {
        if ($fkMeta= $this->xpdo->getFKDefinition($parentClass, $classAlias)) {
            $class= $fkMeta['class'];
            $local= $fkMeta['local'];
            $foreign= $fkMeta['foreign'];
            $this->select($this->xpdo->getSelectColumns($class, $classAlias, $classAlias . '_'));
            $expression= $this->xpdo->escape($parentAlias) . '.' . $this->xpdo->escape($local) . ' = ' .  $this->xpdo->escape($classAlias) . '.' . $this->xpdo->escape($foreign);
            if (isset($fkMeta['criteria']['local'])) {
                $localCriteria = array();
                if (is_array($fkMeta['criteria']['local'])) {
                    foreach ($fkMeta['criteria']['local'] as $critKey => $critVal) {
                        if (is_numeric($critKey)) {
                            $localCriteria[] = $critVal;
                        } else {
                            $localCriteria["{$classAlias}.{$critKey}"] = $critVal;
                        }
                    }
                }
                if (!empty($localCriteria)) {
                    $expression = array($localCriteria, $expression);
                }
                $foreignCriteria = array();
                if (is_array($fkMeta['criteria']['foreign'])) {
                    foreach ($fkMeta['criteria']['foreign'] as $critKey => $critVal) {
                        if (is_numeric($critKey)) {
                            $foreignCriteria[] = $critVal;
                        } else {
                            $foreignCriteria["{$parentAlias}.{$critKey}"] = $critVal;
                        }
                    }
                }
                if (!empty($foreignCriteria)) {
                    $expression = array($foreignCriteria, $expression);
                }
            }
            $this->leftJoin($class, $classAlias, $expression);
            if (!empty ($relations)) {
                foreach ($relations as $relationAlias => $subRelations) {
                    $this->bindGraphNode($class, $classAlias, $relationAlias, $subRelations);
                }
            }
        }
    }
public function bindGraphNode($parentClass, $parentAlias, $classAlias, $relations) {
        if ($fkMeta= $this->xpdo->getFKDefinition($parentClass, $classAlias)) {
            $class= $fkMeta['class'];
            $local= $fkMeta['local'];
            $foreign= $fkMeta['foreign'];
            $this->select($this->xpdo->getSelectColumns($class, $classAlias, $classAlias . '_'));
            $expression= $this->xpdo->escape($parentAlias) . '.' . $this->xpdo->escape($local) . ' = ' .  $this->xpdo->escape($classAlias) . '.' . $this->xpdo->escape($foreign);
            if (isset($fkMeta['criteria']['local'])) {
                $localCriteria = array();
                if (is_array($fkMeta['criteria']['local'])) {
                    foreach ($fkMeta['criteria']['local'] as $critKey => $critVal) {
                        if (is_numeric($critKey)) {
                            $localCriteria[] = $critVal;
                        } else {
                            $localCriteria["{$classAlias}.{$critKey}"] = $critVal;
                        }
                    }
                }
                if (!empty($localCriteria)) {
                    $expression = array($localCriteria, $expression);
                }
                $foreignCriteria = array();
                if (is_array($fkMeta['criteria']['foreign'])) {
                    foreach ($fkMeta['criteria']['foreign'] as $critKey => $critVal) {
                        if (is_numeric($critKey)) {
                            $foreignCriteria[] = $critVal;
                        } else {
                            $foreignCriteria["{$parentAlias}.{$critKey}"] = $critVal;
                        }
                    }
                }
                if (!empty($foreignCriteria)) {
                    $expression = array($foreignCriteria, $expression);
                }
            }
            $this->leftJoin($class, $classAlias, $expression);
            if (!empty ($relations)) {
                foreach ($relations as $relationAlias => $subRelations) {
                    $this->bindGraphNode($class, $classAlias, $relationAlias, $subRelations);
                }
            }
        }
    }
public function bindGraphNode ( $ parentClass , $ parentAlias , $ classAlias , $ relations ) { if ( $ fkMeta = $ this -> xpdo -> getFKDefinition ( $ parentClass , $ classAlias ) ) { $ class = $ fkMeta [ 'class' ] ; $ local = $ fkMeta [ 'local' ] ; $ foreign = $ fkMeta [ 'foreign' ] ; $ this -> select ( $ this -> xpdo -> getSelectColumns ( $ class , $ classAlias , $ classAlias . '_' ) ) ; $ expression = $ this -> xpdo -> escape ( $ parentAlias ) . '.' . $ this -> xpdo -> escape ( $ local ) . ' = ' . $ this -> xpdo -> escape ( $ classAlias ) . '.' . $ this -> xpdo -> escape ( $ foreign ) ; if ( isset ( $ fkMeta [ 'criteria' ] [ 'local' ] ) ) { $ localCriteria = array ( ) ; if ( is_array ( $ fkMeta [ 'criteria' ] [ 'local' ] ) ) { foreach ( $ fkMeta [ 'criteria' ] [ 'local' ] as $ critKey => $ critVal ) { if ( is_numeric ( $ critKey ) ) { $ localCriteria [ ] = $ critVal ; } else { $ localCriteria [ "{$classAlias}.{$critKey}" ] = $ critVal ; } } } if ( ! empty ( $ localCriteria ) ) { $ expression = array ( $ localCriteria , $ expression ) ; } $ foreignCriteria = array ( ) ; if ( is_array ( $ fkMeta [ 'criteria' ] [ 'foreign' ] ) ) { foreach ( $ fkMeta [ 'criteria' ] [ 'foreign' ] as $ critKey => $ critVal ) { if ( is_numeric ( $ critKey ) ) { $ foreignCriteria [ ] = $ critVal ; } else { $ foreignCriteria [ "{$parentAlias}.{$critKey}" ] = $ critVal ; } } } if ( ! empty ( $ foreignCriteria ) ) { $ expression = array ( $ foreignCriteria , $ expression ) ; } } $ this -> leftJoin ( $ class , $ classAlias , $ expression ) ; if ( ! empty ( $ relations ) ) { foreach ( $ relations as $ relationAlias => $ subRelations ) { $ this -> bindGraphNode ( $ class , $ classAlias , $ relationAlias , $ subRelations ) ; } } } }
Bind the node of an object graph to the query.

@param string $parentClass The class representing the relation parent.
@param string $parentAlias The alias the class is assuming.
@param string $classAlias The class representing the related graph node.
@param array $relations Child relations of the current graph node.
Bind the node of an object graph to the query .