Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function rewind()
 {
     if ($this->autoloadEnabled && $this->paginator->getPageNumber() > 1) {
         $this->paginator->setPageNumber(1);
         /** @var Collection $newCollection */
         $newCollection = $this->adapter->map($this->subject, $this->context)->call($this->method, $this->criteria, $this->paginator);
         $this->iterator = new \ArrayIterator($newCollection->asArray(false));
     }
     $this->iterator->rewind();
 }
Ejemplo n.º 2
0
 /**
  * @param Documents $documents
  * @return Collection
  * @depends testDocumentsApi
  */
 public function testCollectionAutoloadOff(Documents $documents)
 {
     $criteria = new SearchEstimatesCriteria();
     $criteria->setCreatePeriod(new \DateTime('@1457478000'), new \DateTime('@1457564400'));
     $paginator = new Paginator();
     $paginator->setNumberPerPage(10);
     $paginator->setPageNumber(1);
     $estimates = $documents->searchEstimates($criteria, $paginator);
     $estimatesCount = 0;
     /** @var EstimateInterface $estimate */
     foreach ($estimates as $estimate) {
         $estimatesCount++;
     }
     $this->assertEquals(10, $estimatesCount);
     return $estimates;
 }