How can I use this query in DQL (Symfony2):
SELECT id FROM user WHERE DATE_FORMAT( birth_date ,'%m-%d') = DATE_FORMAT( NOW() + INTERVAL 7 DAY ,'%m-%d')
I use beberlei/DoctrineExtensions, I added this is my config:
orm:
dql:
string_functions:
date_format: DoctrineExtensions\Query\Mysql\DateFormat
dateadd: DoctrineExtensions\Query\Mysql\DateAdd
I tried this, inside the UserRepository:
$qb = $this->createQueryBuilder('U');
$qb ->select('U')
->where( 'DATE_FORMAT( U.birthDate, %m-%d) = DATE_FORMAT( CURRENT_TIMESTAMP() + INTERVAL 7 DAY, %m-%d' );
but it's not working.
Thanks in advance!