andreas-glaser / doctrine-rql
Parses and applies RQL/FIQL scripts to doctrine orm query builders
Installs: 50 197
Dependents: 2
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 4
Open Issues: 2
Requires
- php: ^7.4|^8.0
- andreas-glaser/php-helpers: ^1.2.0
- doctrine/orm: ^2.4.8
- graviton/rql-parser: ^3
Requires (Dev)
- ext-sqlite3: *
- doctrine/data-fixtures: ^1.3.1
- friendsofphp/php-cs-fixer: @stable
- phpunit/phpunit: ^8
- symfony/var-dumper: ^4.3.2
README
Parses and applies RQL/FIQL scripts to doctrine orm query builders.
Installation
composer require andreas-glaser/doctrine-rql 0.4.*
Usage Test
<?php require 'vendor/autoload.php'; use AndreasGlaser\DoctrineRql\Factory\ORMVisitorFactory; $rqlString = $_GET['rql']; // ?rql=and(eq(cart.id,123),eq(cart.archived,0)) /** @var QueryBuilder $qb */ $qb = $entityManager->createQueryBuilder(); $qb ->select('cart') ->from('TestApp\Entity\Cart', 'cart'); // append filters ORMVisitorFactory::appendFiltersOnly($queryBuilder, $rqlString, false); /** @var TestApp\Entity\Cart[] $cartEntities */ $cartEntities = $qb ->getQuery() ->execute();
A full list of available RQL/FIQL operators can be found at:
https://github.com/libgraviton/rql-parser/#operators
Additional Operators
- NULL Comparison
isnull(fieldName)
isnotnull(fieldName)