Skip to content

Instantly share code, notes, and snippets.

@jasonhofer
jasonhofer / doctrine-dql-type-function.php
Last active January 8, 2026 03:30
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;