I know from the documentation at: http://docs.doctrine-project.org/en/2.1/reference/dql-doctrine-query-language.html#dql-functions that there is no ROUND function but is the
You need to implement a custom DQL function for that.
There's some examples in DoctrineExtensions.
You can implement it like following:
walkSimpleArithmeticExpression(
$this->arithmeticExpression
) . ')';
}
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$lexer = $parser->getLexer();
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->arithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
}
You can then register it in the configuration while bootstrapping the ORM:
$config = new \Doctrine\ORM\Configuration();
$config->addCustomNumericFunction('ROUND', 'MyApp\DQL\Round');