src/Reader/OneToManyReader.php
public function current()
    {
        $leftRow = $this->leftReader->current();

        if (array_key_exists($this->nestKey, $leftRow)) {
            throw new ReaderException(
                sprintf(
                    'Left Row: "%s" Reader already contains a field named "%s". Please choose a different nest key field',
                    $this->key(),
                    $this->nestKey
                )
            );
        }
        $leftRow[$this->nestKey] = [];

        $leftId     = $this->getRowId($leftRow, $this->leftJoinField);
        $rightRow   = $this->rightReader->current();
        $rightId    = $this->getRowId($rightRow, $this->rightJoinField);

        while ($leftId == $rightId && $this->rightReader->valid()) {

            $leftRow[$this->nestKey][] = $rightRow;
            $this->rightReader->next();

            $rightRow = $this->rightReader->current();

            if($this->rightReader->valid()) {
                $rightId = $this->getRowId($rightRow, $this->rightJoinField);
            }
        }

        return $leftRow;
    }
public function current()
    {
        $leftRow = $this->leftReader->current();

        if (array_key_exists($this->nestKey, $leftRow)) {
            throw new ReaderException(
                sprintf(
                    'Left Row: "%s" Reader already contains a field named "%s". Please choose a different nest key field',
                    $this->key(),
                    $this->nestKey
                )
            );
        }
        $leftRow[$this->nestKey] = [];

        $leftId     = $this->getRowId($leftRow, $this->leftJoinField);
        $rightRow   = $this->rightReader->current();
        $rightId    = $this->getRowId($rightRow, $this->rightJoinField);

        while ($leftId == $rightId && $this->rightReader->valid()) {

            $leftRow[$this->nestKey][] = $rightRow;
            $this->rightReader->next();

            $rightRow = $this->rightReader->current();

            if($this->rightReader->valid()) {
                $rightId = $this->getRowId($rightRow, $this->rightJoinField);
            }
        }

        return $leftRow;
    }
public function current ( ) { $ leftRow = $ this -> leftReader -> current ( ) ; if ( array_key_exists ( $ this -> nestKey , $ leftRow ) ) { throw new ReaderException ( sprintf ( 'Left Row: "%s" Reader already contains a field named "%s". Please choose a different nest key field' , $ this -> key ( ) , $ this -> nestKey ) ) ; } $ leftRow [ $ this -> nestKey ] = [ ] ; $ leftId = $ this -> getRowId ( $ leftRow , $ this -> leftJoinField ) ; $ rightRow = $ this -> rightReader -> current ( ) ; $ rightId = $ this -> getRowId ( $ rightRow , $ this -> rightJoinField ) ; while ( $ leftId == $ rightId && $ this -> rightReader -> valid ( ) ) { $ leftRow [ $ this -> nestKey ] [ ] = $ rightRow ; $ this -> rightReader -> next ( ) ; $ rightRow = $ this -> rightReader -> current ( ) ; if ( $ this -> rightReader -> valid ( ) ) { $ rightId = $ this -> getRowId ( $ rightRow , $ this -> rightJoinField ) ; } } return $ leftRow ; }
Create an array of children in the leftRow,
with the data returned from the right reader
Where the ID fields Match

@return array

@throws ReaderException
Create an array of children in the leftRow with the data returned from the right reader Where the ID fields Match