Skip to content

Doctrine ORM

Symftony edited this page Dec 10, 2017 · 3 revisions

Doctrine ORM Expression

/!\ ORM Expression doesn't support not and not or xor

These not supported operator was not allowed to use and the parser will throw UnsupportedTokenTypeException

use Doctrine\ORM\Query\Expr;
use Symftony\Xpression\Bridge\Doctrine\ORM\ExprAdapter;
use Symftony\Xpression\Parser;

QueryStringParser::correctServerQueryString();

$parser = new Parser(new ExprAdapter(new Expr()));
$expression = $parser->parse($_GET['query']);

$driver = new Driver();
$connection = new Connection(array(), $driver);

$results = $connection
    ->createQueryBuilder()
    ->setQueryArray($expression->getQuery())
    ->getQuery()
    ->execute();
Clone this wiki locally