protected function generateJoin(array &$fields)
    {
        $annotations = $this->annotations['class'];
        $props = $this->annotations['properties'];
        $table = '';
        foreach (['Require' => '', 'Include' => 'LEFT '] as $type => $join) {
            if (isset($annotations[$type])) {
                foreach ($annotations[$type] as $local => $joinCond) {
                    if (is_numeric($local)) {
                        foreach ($joinCond as $local => $joinCond) {
                        }
                    }
                    // Hack to make the annotationParser recurse.
                    $joinCond = AnnotationParser::getAnnotations(
                        '/** @joinCond '.implode(', ', $joinCond).' */'
                    )['joincond'];
                    $table .= sprintf(
                        ' %1$sJOIN %2$s ON ',
                        $join,
                        $local
                    );
                    $conds = [];
                    foreach ($joinCond as $ref => $me) {
                        if ($me == '?') {
                            $conds[] = sprintf(
                                "%s.%s = $me",
                                $local,
                                $ref
                            );
                        } else {
                            $conds[] = sprintf(
                                "%s.%s = %s.%s",
                                $local,
                                $ref,
                                $this->identifier,
                                $me
                            );
                        }
                    }
                    $table .= implode(" AND ", $conds);
                }
            }
        }
        foreach ($fields as &$field) {
            $name = str_replace("{$this->identifier}.", '', $field);
            if (isset($props[$name]['From'])) {
                $field = sprintf(
                    '%s %s',
                    $props[$name]['From'],
                    $name
                );
            }
        }
        return $table;
    }
protected function generateJoin(array &$fields)
    {
        $annotations = $this->annotations['class'];
        $props = $this->annotations['properties'];
        $table = '';
        foreach (['Require' => '', 'Include' => 'LEFT '] as $type => $join) {
            if (isset($annotations[$type])) {
                foreach ($annotations[$type] as $local => $joinCond) {
                    if (is_numeric($local)) {
                        foreach ($joinCond as $local => $joinCond) {
                        }
                    }
                    // Hack to make the annotationParser recurse.
                    $joinCond = AnnotationParser::getAnnotations(
                        '/** @joinCond '.implode(', ', $joinCond).' */'
                    )['joincond'];
                    $table .= sprintf(
                        ' %1$sJOIN %2$s ON ',
                        $join,
                        $local
                    );
                    $conds = [];
                    foreach ($joinCond as $ref => $me) {
                        if ($me == '?') {
                            $conds[] = sprintf(
                                "%s.%s = $me",
                                $local,
                                $ref
                            );
                        } else {
                            $conds[] = sprintf(
                                "%s.%s = %s.%s",
                                $local,
                                $ref,
                                $this->identifier,
                                $me
                            );
                        }
                    }
                    $table .= implode(" AND ", $conds);
                }
            }
        }
        foreach ($fields as &$field) {
            $name = str_replace("{$this->identifier}.", '', $field);
            if (isset($props[$name]['From'])) {
                $field = sprintf(
                    '%s %s',
                    $props[$name]['From'],
                    $name
                );
            }
        }
        return $table;
    }
protected function generateJoin ( array & $ fields ) { $ annotations = $ this -> annotations [ 'class' ] ; $ props = $ this -> annotations [ 'properties' ] ; $ table = '' ; foreach ( [ 'Require' => '' , 'Include' => 'LEFT ' ] as $ type => $ join ) { if ( isset ( $ annotations [ $ type ] ) ) { foreach ( $ annotations [ $ type ] as $ local => $ joinCond ) { if ( is_numeric ( $ local ) ) { foreach ( $ joinCond as $ local => $ joinCond ) { } } // Hack to make the annotationParser recurse. $ joinCond = AnnotationParser :: getAnnotations ( '/** @joinCond ' . implode ( ', ' , $ joinCond ) . ' */' ) [ 'joincond' ] ; $ table .= sprintf ( ' %1$sJOIN %2$s ON ' , $ join , $ local ) ; $ conds = [ ] ; foreach ( $ joinCond as $ ref => $ me ) { if ( $ me == '?' ) { $ conds [ ] = sprintf ( "%s.%s = $me" , $ local , $ ref ) ; } else { $ conds [ ] = sprintf ( "%s.%s = %s.%s" , $ local , $ ref , $ this -> identifier , $ me ) ; } } $ table .= implode ( " AND " , $ conds ) ; } } } foreach ( $ fields as & $ field ) { $ name = str_replace ( "{$this->identifier}." , '' , $ field ) ; if ( isset ( $ props [ $ name ] [ 'From' ] ) ) { $ field = sprintf ( '%s %s' , $ props [ $ name ] [ 'From' ] , $ name ) ; } } return $ table ; }
Internal helper to generate a JOIN statement.

@param array $fields Array of fields to extend.
@return string The JOIN statement to append to the query string.
Internal helper to generate a JOIN statement .