Skip to content

Helper library to implement doctrine powered server-side processing for jquery-datatables with joins, search, filtering and ordering.

License

Notifications You must be signed in to change notification settings

Moosjes/doctrine-datatables

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vaibhavpandeyvpz/doctrine-datatables

Helper library to implement Doctrine powered server-side processing for jquery-datatables with joins, search, filtering and ordering.

Latest Version Scrutinizer Code Quality SensioLabsInsight Total Downloads Software License

Install

composer require vaibhavpandeyvpz/doctrine-datatables

Usage with doctrine/dbal:

<?php

use Doctrine\DataTables;

$connection = /** instanceof Doctrine\DBAL\Connection */;

$datatables = (new DataTables\Builder())
    ->withIndexColumn('id')
    ->withQueryBuilder(
        $connection->createQueryBuilder()
            ->select('*')
            ->from('users')
    )
    ->withRequestParams($_GET);

echo json_encode($datatables->getResponse());

Usage with doctrine/orm:

<?php

use Doctrine\DataTables;

$em = /** instanceof Doctrine\ORM\EntityManager */;

$datatables = (new DataTables\Builder())
    ->withColumnAliases([
        'id' => 'u.id',
        'name' => 'u.name',
        'email' => 'u.email',
        'createdAt' => 'u.createdAt',
        'updatedAt' => 'u.updatedAt',
    ])
    ->withIndexColumn('u.id')
    ->withQueryBuilder(
        $em->createQueryBuilder()
            ->select('u')
            ->from(User::class, 'u'))
    ->withRequestParams($_GET);

echo json_encode($datatables->getResponse());

License

See LICENSE.md file.

About

Helper library to implement doctrine powered server-side processing for jquery-datatables with joins, search, filtering and ordering.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%