public function buildView(TableView $view, TableInterface $table)
 {
     $data = array();
     foreach ($table->getData()->getRows() as $_data) {
         $row = $this->resolveParams($table->getOption('rows_params'), $_data, true);
         $data['row_' . implode('_', $row)] = $row;
     }
     $view->setData($data);
 }
 public function setUp()
 {
     $this->decoratorMock = $this->getMock('EMC\\TableBundle\\Table\\Type\\Decorator\\TableDecoratorInterface');
     $this->tableTypeMock = $this->getMock('EMC\\TableBundle\\Table\\Type\\TableTypeInterface');
     $this->columnTypeMock = $this->getMock('EMC\\TableBundle\\Table\\Column\\Type\\ColumnTypeInterface');
     $this->columnMock = $this->getMock('EMC\\TableBundle\\Table\\Column\\ColumnInterface');
     $this->columnMock->expects($this->any())->method('getType')->will($this->returnValue($this->columnTypeMock));
     $expectedView = array('a' => 1, 'b' => '2');
     $this->expectedView = $expectedView;
     $this->tableTypeMock->expects($this->any())->method('buildHeaderCellView')->willReturnCallback(function (&$view, $column) use($expectedView) {
         $view = $expectedView;
     });
     $this->tableTypeMock->expects($this->any())->method('buildBodyCellView')->willReturnCallback(function (&$view, $column) use($expectedView) {
         $view = $expectedView;
     });
     $this->tableMock = $this->getMock('EMC\\TableBundle\\Table\\TableInterface');
     $this->tableMock->method('getType')->will($this->returnValue($this->tableTypeMock));
     $this->queryConfig = new QueryConfig();
     $this->queryConfig->setLimit(5)->setSelect(array('t.a', 't.b', 't.c'))->setPage(2)->setOrderBy(array('t.d' => true, 't.e' => false))->addParameter('query', '%xxx%')->getConstraints()->add('LOWER(t.a) LIKE :query')->add('LOWER(t.c) LIKE :query');
 }
Beispiel #3
0
 private function extractConfig(TableInterface $table, array $data = null, array $options = array())
 {
     $data = array('id' => $table->getOption('name'), 'name' => $table->getOption('name'), 'type' => $table->getType()->getName(), 'type_class' => get_class($table->getType()), 'passed_options' => array(), 'resolved_options' => array(), 'columns' => array());
     foreach ($table->getOptions() as $option => $value) {
         if (substr($option, 0, 1) !== '_') {
             $data['resolved_options'][$option] = $this->valueExporter->exportValue($value);
         }
     }
     foreach ($options['_passed_options'] as $option => $value) {
         $data['passed_options'][$option] = $this->valueExporter->exportValue($value);
     }
     ksort($data['passed_options']);
     ksort($data['resolved_options']);
     /* @var $column \EMC\TableBundle\Table\Column\ColumnInterface */
     $column = null;
     foreach ($table->getColumns() as $column) {
         $data['columns'][$column->getOption('name')] = $this->extractColumnConfig($column);
     }
     return $data;
 }
Beispiel #4
0
 /**
  * @expectedException \UnexpectedValueException
  */
 public function testExportUnexpectedValueException()
 {
     $this->table->export('c');
 }