vaibhavpandeyvpz / doctrine-datatables
Helper library to implement doctrine powered server-side processing for jquery-datatables with joins, search, filtering and ordering.
Installs: 49 411
Dependents: 1
Suggesters: 2
Security: 0
Stars: 21
Watchers: 5
Forks: 16
Open Issues: 6
Requires
- php: >=5.3.0
- doctrine/dbal: ~2.5
Requires (Dev)
- doctrine/orm: ~2.5
README
Helper library to implement Doctrine powered server-side processing for jquery-datatables with joins, search, filtering and ordering.
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.