PHP code example of andreas-glaser / doctrine-rql

1. Go to this page and download the library: Download andreas-glaser/doctrine-rql 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/ */

    

andreas-glaser / doctrine-rql example snippets




ndreasGlaser\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();