Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

How to use Intl component with table builider?

$
0
0

Hey I use ominis/datatables bundle in Symfony 4.3. I store in my db country code from Intl. How to use Intl::getRegionBundle()->getCountryName($value) when i'm using table builider. My code below (but not working)

$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();
    }     

Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>