src/Request.php
public function fetchAll()
    {
        $this->fetchPrepareFrom();
        $this->loadAllColumnsSchema();
        $this->fetchPrepareSelect();
        $this->fetchPrepareWhere();
        $this->fetchPrepareOrderBy();
        $this->fetchPrepareUnion();
        $this->fetchPrepareLimit();

        $return = [];
        /* Le pointeur en cas de limite de résultat. */
        $i      = 0;

        /*
         * Exécution des jointures.
         * La réunion et l'intersection des ensembles sont soumis à la loi interne * et donc commutative.
         */
        foreach ($this->request[ 'leftJoin' ] as $value) {
            $this->executeLeftJoin($value[ 'table' ], $value[ 'where' ]);
        }

        foreach ($this->request[ 'rightJoin' ] as $value) {
            $this->executeRightJoin($value[ 'table' ], $value[ 'where' ]);
        }

        $limitHandel = $this->orderBy || $this->request['union'];
        foreach ($this->tableData as $row) {
            /* WHERE */
            if ($this->where && !$this->where->execute($row)) {
                continue;
            }

            /* LIMITE */
            if ($this->limit && !$limitHandel) {
                if ($i++ < $this->offset) {
                    continue;
                }
                if (($i++ > $this->offset + $this->limit) && ($this->limit <= count($return))) {
                    break;
                }
            }

            /* SELECT */
            if ($this->lists !== null) {
                $return[] = $row[ $this->lists ];
            } elseif ($this->request[ 'columns' ]) {
                $column   = array_flip($this->request[ 'columns' ]);
                $return[] = array_intersect_key($row, $column);
            } else {
                $return[] = $row;
            }
        }

        /* UNION */
        foreach ($this->request[ 'union' ] as $union) {
            /* Si le retour est demandé en liste. */
            $fetch = $this->lists !== null
                ? $union[ 'request' ]->lists()
                : $union[ 'request' ]->fetchAll();

            /**
             * UNION ALL
             * Pour chaque requêtes unions, on récupère les résultats.
             * On merge puis on supprime les doublons.
             */
            $return = array_merge($return, $fetch);

            /* UNION */
            if ($union[ 'type' ] !== 'all') {
                $return = $this->arrayUniqueMultidimensional($return);
            }
        }

        /* ORDER BY */
        if ($this->orderBy) {
            $return = $this->executeOrderBy($return, $this->orderBy);
        }
        
        /* LIMIT */
        if ($this->limit && $limitHandel) {
            $return = array_slice($return, $this->offset, $this->limit);
        }

        $this->init();

        return $return;
    }
public function fetchAll()
    {
        $this->fetchPrepareFrom();
        $this->loadAllColumnsSchema();
        $this->fetchPrepareSelect();
        $this->fetchPrepareWhere();
        $this->fetchPrepareOrderBy();
        $this->fetchPrepareUnion();
        $this->fetchPrepareLimit();

        $return = [];
        /* Le pointeur en cas de limite de résultat. */
        $i      = 0;

        /*
         * Exécution des jointures.
         * La réunion et l'intersection des ensembles sont soumis à la loi interne * et donc commutative.
         */
        foreach ($this->request[ 'leftJoin' ] as $value) {
            $this->executeLeftJoin($value[ 'table' ], $value[ 'where' ]);
        }

        foreach ($this->request[ 'rightJoin' ] as $value) {
            $this->executeRightJoin($value[ 'table' ], $value[ 'where' ]);
        }

        $limitHandel = $this->orderBy || $this->request['union'];
        foreach ($this->tableData as $row) {
            /* WHERE */
            if ($this->where && !$this->where->execute($row)) {
                continue;
            }

            /* LIMITE */
            if ($this->limit && !$limitHandel) {
                if ($i++ < $this->offset) {
                    continue;
                }
                if (($i++ > $this->offset + $this->limit) && ($this->limit <= count($return))) {
                    break;
                }
            }

            /* SELECT */
            if ($this->lists !== null) {
                $return[] = $row[ $this->lists ];
            } elseif ($this->request[ 'columns' ]) {
                $column   = array_flip($this->request[ 'columns' ]);
                $return[] = array_intersect_key($row, $column);
            } else {
                $return[] = $row;
            }
        }

        /* UNION */
        foreach ($this->request[ 'union' ] as $union) {
            /* Si le retour est demandé en liste. */
            $fetch = $this->lists !== null
                ? $union[ 'request' ]->lists()
                : $union[ 'request' ]->fetchAll();

            /**
             * UNION ALL
             * Pour chaque requêtes unions, on récupère les résultats.
             * On merge puis on supprime les doublons.
             */
            $return = array_merge($return, $fetch);

            /* UNION */
            if ($union[ 'type' ] !== 'all') {
                $return = $this->arrayUniqueMultidimensional($return);
            }
        }

        /* ORDER BY */
        if ($this->orderBy) {
            $return = $this->executeOrderBy($return, $this->orderBy);
        }
        
        /* LIMIT */
        if ($this->limit && $limitHandel) {
            $return = array_slice($return, $this->offset, $this->limit);
        }

        $this->init();

        return $return;
    }
Retourne tous les résultats de la requête.

@return array les données