如何使用内置表的Intl组件



嘿,我在Symfony 4.3中使用ominis/datatables捆绑包。我在数据库中存储来自国际号码的国家代码。如何使用Intl::getRegionBundle()->getCountryName($value)当我使用表内置程序。我的代码在下面(但不工作(

$table = $this->datatableFactory->create([])
->add('name', TextColumn::class, ['label' => 'Name', 'className' => 'bold'])
->add('adress', TextColumn::class, ['label' => 'Adress', 'className' => 'bold'])
->add('city', TextColumn::class, ['label' => 'City', 'className' => 'bold'])
->add('state', TextColumn::class, ['label' => 'State', 'className' => 'bold'])
->add('country_code', TextColumn::class, ['label' => 'Country', 'className' => 'bold', 'render' => function($value, $context) {
return Intl::getRegionBundle()->getCountryName($value);}])
->add('vat', TextColumn::class, ['label' => 'VAT', 'className' => 'bold'])
->add('regon', TextColumn::class, ['label' => 'Regon', 'className' => 'bold'])
->createAdapter(ORMAdapter::class, [
'entity' => Company::class
])
->handleRequest($request);
if ($table->isCallback()) {
return $table->getResponse();
}     

这项工作我在字段名-,-上犯了错误

相关内容

最新更新