Closed timo002 closed 5 years ago
Found my own anwser!
Entity/dummy.php
public function getSomething(): ?string
{
return $this->someVar . '-' . $this->anotherVar;
}
In my datatables I need to add both columns $someVar and $anotherVar:
$dataTableFactory->create()
->add('someting', TextColumn::class, [
'render' => function($value, $context) {
return $context->getSomething();
}
])
->add('someVar', TextColumn::class, ['visible' => false')
->add('anotherVar', TextColumn::class, ['visible' => false')
I need to combine the result of multiple database column to one datatable columns. How can I get that working?
My Entity already has a method for it so I can call it in my controller or twig so I always get the same formating and only need to configure it once.