PHP code example of zhortein / datatable-bundle
1. Go to this page and download the library: Download zhortein/datatable-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhortein / datatable-bundle example snippets
namespace App\Datatable;
use App\Entity\User;
use Zhortein\DatatableBundle\Attribute\AsDatatable;
use Zhortein\DatatableBundle\Contract\DatatableInterface;
use Zhortein\DatatableBundle\Definition\DatatableDefinition;
#[AsDatatable(name: 'users')]
final class UserDatatable implements DatatableInterface
{
public function buildDatatable(DatatableDefinition $definition): void
{
$definition
->setEntityClass(User::class)
->addColumn('e.id', visible: false)
->addColumn('e.email', label: 'Email')
->addColumn('e.createdAt', label: 'Created At', searchable: false, type: 'datetime')
;
}
}