/** * {@inheritdoc} */ public function read() { $this->documentManager->clear(); if (!$this->executed) { $this->executed = true; if (!is_object($this->channel)) { $this->channel = $this->channelManager->getChannelByCode($this->channel); } if ($this->missingCompleteness) { $this->completenessManager->generateMissingForChannel($this->channel); } $this->query = $this->repository->buildByChannelAndCompleteness($this->channel)->getQuery(); $this->products = $this->getQuery()->execute(); // MongoDB Cursor are not positioned on first element (whereas ArrayIterator is) // as long as getNext() hasn't be called $this->products->getNext(); } $result = $this->products->current(); if ($result) { $this->metricConverter->convert($result, $this->channel); $this->stepExecution->incrementSummaryInfo('read'); $this->products->next(); } return $result; }
/** * @{inheritdoc} */ public function read() { $product = null; if ($this->products->valid()) { $product = $this->products->current(); $this->stepExecution->incrementSummaryInfo('read'); $this->products->next(); } if (null !== $product) { $channel = $this->channelManager->getChannelByCode($this->channel); $this->metricConverter->convert($product, $channel); } return $product; }
/** * Returns the document the cursor is currently pointing to * @return \Todo */ public function current() { $output = new Todo(); $output->document = parent::current(); return $output; }
/** * Returns the document the cursor is currently pointing to * @return array */ public function current() { // $output = new Todo(); // $output->document = parent::current(); return parent::current(); }