Esempio n. 1
0
 /**
  * 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
  */
 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] = array();
     $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;
 }