/**
  * @return string
  */
 public function build()
 {
     $overview = new Overview();
     foreach ($this->fields as $field) {
         $element = $this->form->get($field);
         $label = $element->createView()->vars['label'];
         $overview->label($field, $label);
     }
     $q = $this->getQueryBuilder();
     $collection = $q->paginate($this->limit);
     $overview->setCollection($collection);
     foreach ($collection as $record) {
         $columns = array();
         foreach ($this->fields as $field) {
             $columns[$field] = $this->buildColumn($field, $this->form->get($field), $record);
         }
         $overview->row($record->id, $columns);
     }
     return $overview;
 }
 /**
  * @return string
  */
 public function build()
 {
     $overview = new Overview();
     $mb = $this->getModelBuilder();
     $fb = $this->getFormBuilder();
     $model = $mb->build();
     if (!$this->fields) {
         $this->fields = $model->getFillable();
     }
     foreach ($this->fields as $field) {
         if (!$fb->has($field)) {
             continue;
         }
         // Get the label for this field
         $element = $fb->get($field);
         $label = $element->getLabel();
         $overview->label($field, $label);
     }
     $q = $this->getQueryBuilder();
     $collection = $q->paginate($this->limit);
     $overview->setCollection($collection);
     foreach ($collection as $record) {
         $columns = array();
         foreach ($this->fields as $field) {
             if (!$fb->has($field)) {
                 continue;
             }
             $columns[$field] = $this->buildColumn($field, $fb->get($field), $record);
         }
         $overview->row($record->id, $columns);
     }
     return $overview;
 }