public function buildBodyCellView(array &$view, ColumnInterface $column, array $data) { if (!$column->getType()->isExportable()) { $view = null; return; } return parent::buildBodyCellView($view, $column, $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'); }
private function extractColumnConfig(ColumnInterface $column) { $data = array('id' => $column->getOption('name'), 'name' => $column->getOption('name'), 'type' => $column->getType()->getName(), 'type_class' => get_class($column->getType()), 'passed_options' => array(), 'resolved_options' => array()); foreach ($column->getOptions() as $option => $value) { if (substr($option, 0, 1) !== '_') { $data['resolved_options'][$option] = $this->valueExporter->exportValue($value); } } foreach ($column->getOption('_passed_options') as $option => $value) { $data['passed_options'][$option] = $this->valueExporter->exportValue($value); } return $data; }
/** * {@inheritdoc} */ public function buildHeaderView(array &$view, ColumnInterface $column) { $view = array('sort' => $column->getOption('allow_sort'), 'title' => $column->getOption('title'), 'width' => $column->getOption('width')); }