Skip to content

Instantly share code, notes, and snippets.

@jasonhofer
jasonhofer / doctrine-dql-type-function.php
Last active December 30, 2021 21:11
Doctrine TYPE() function for DQL. Provides a way to access an entity's discriminator field in DQL queries.
<?php
namespace My\Doctrine\ORM\Query\Functions;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\QueryException;
use Doctrine\ORM\Query\SqlWalker;