Esempio n. 1
0
 public function testIteratorAggregateCollection()
 {
     $array = $this->getArrayData();
     $iterator = new \ArrayIterator($array);
     $data = new DelegatingIterator($iterator);
     $collection = new Collection($data);
     $this->assertSame($iterator, $collection->getRaw());
     $this->assertEquals($array[0], $collection->getPeek()->getRaw());
     $this->assertEquals($array[0], $collection->next()->getRaw());
     $this->assertEquals($array[1], $collection->next()->getRaw());
     $this->assertEquals($array[2], $collection->getPeek()->getRaw());
     $collection->rewind();
     $this->assertEquals($array[0], $collection->next()->getRaw());
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function buildGrid(Grid $grid, Schema $schema, Collection $collection, array $options = array())
 {
     $index = 0;
     while ($entity = $collection->next()) {
         $schema->build($row = new Row(self::NAME), $entity, $options);
         $grid->getBody()->add($entity->getId() ?: $index++, $row);
     }
 }