Symfony2 Doctrine Qb STR_TO_DATE Unknown Function
doctrine, doctrine-orm, mysql, php, symfony
Solution
The `STR_TO_DATE` function is not available in DQL. See DQL Functions.
However you can make it available by installing `beberlei/DoctrineExtensions` and adding this to your `config.yml`:
doctrine:
orm:
dql:
datetime_functions:
# ...
strtodate: DoctrineExtensions\Query\Mysql\StrToDate
Problem
When i try to execute STR_TO_DATE mysql function with Doctrine query builder, symfony2 throws an exception like: Error: Expected known function, got 'STR_TO_DATE' My code is : ``` STR_TO_DATE(m.metaValue, '%m/%d/%Y') BETWEEN '".$filter["sDate"]["month"]."/01/".$filter["sDate"]["year"]."' AND '".$filter["eDate"]["month"]."/01/".$filter["eDate"]["year"]."'" ``` How can i get it work?