Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function build()
 {
     $columns = $this->getColumns();
     $columns = $this->mapper->mapColumns($columns);
     $this->datagrid->setColumns($columns);
     $rows = $this->getRows();
     $rows = $this->mapper->mapRows($rows, $columns);
     $this->datagrid->setRows($rows);
     $this->handleViewForm();
     $views = $this->getViewRepository()->findByEntity(get_class($this->datagrid->getSource()));
     $this->datagrid->setViews($views);
     return $this->datagrid;
 }
Ejemplo n.º 2
0
 public function testMapColumns()
 {
     $input = array(array('property' => 'name', 'type' => 'text', 'options' => array('label' => 'User name')));
     $mapper = new DatagridMapper();
     $actual = $mapper->mapColumns($input);
     $column = new Column();
     $column->setProperty('name');
     $column->setCellType(new TextCell());
     $column->setLabel('User name');
     $expected = new ArrayCollection();
     $expected->add($column);
     $this->assertEquals($expected, $actual);
 }