I want to perform a query which would look like this in native SQL:
SELECT
AVG(t.column) AS average_value
FROM
table t
WHERE
YEAR(t.timestamp) =
In Symfony 4 you must install DoctrineExtensions:
composer require beberlei/DoctrineExtensions
And then edit the doctrine config file (config/packages/doctrine.yaml) as follow:
doctrine:
orm:
dql:
string_functions:
MONTH: DoctrineExtensions\Query\Mysql\Month
YEAR: DoctrineExtensions\Query\Mysql\Year