I have to make requests with YEAR and I installed beberlei/DoctrineExtensions with doctrine command. I added the requested annotations
doctrine:
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
dql:
datetime_functions:
year: DoctrineExtensions\Query\Mysql\Year
, but it does not work, I have this error:
Attempted to load class "Year" from namespace "DoctrineExtensions\Query\Mysql". Did you forget a "use" statement for another namespace?
The request:
public function groupTypeInterArray(){
$qb = $this->createQueryBuilder('i')
->select('YEAR(i.interventionDate)');
return $qb->getQuery()->execute();
}
Config Doctrine
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: '%kernel.project_dir%/var/data/data.sqlite'
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
#path: '%database_path%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
dql:
datetime_functions:
Year: DoctrineExtensions\Query\Mysql\Year
I searched all the afternoon, but I didn't find the solution.
Thank you in advance.