/** * @param Entity $entity * @param Paginator $pagination */ public function createTable(Entity $entity, Paginator $pagination) { $table = new Table(); $table->createHead($entity->getOptions()->getFields()); $hydrator = new ClassMethods(); foreach ($pagination as $entity) { $row = $table->createRow(); foreach ($hydrator->extract($entity) as $key => $value) { $row->setValue($key, $value); } } return $table; }
public function testEmptyTable() { $table = new Table(); $table->setHead(new Row(['id'])); $this->assertCount(0, iterator_to_array($table)); }