I'm porting simple web application written in CodeIgniter to Symfony2 bundle. I'm new into Symfony2 and Doctrine and I've a problem with one SQL query, that I want to rewrite in DQL. I've all ready to go in my bundle, I've created Entity class and I'm able to insert data to database and do simple queries in Object-Oriented-Programming way that Symfony2 provides. Unfortunately, I have no idea how to implement this SQL query in DQL:
$sql = "SELECT * FROM t WHERE
UNIX_TIMESTAMP(t.date) > ".(time()-300)." AND
ROUND(t.x,3) = ".round($x, 3);
As you can see there are some SQL function calls, that needs to be executed on database server. Doctrine can't understand this calls. For sure, I have an option to quit using Doctrine and do this query using basic PDO inside my Symfony2 bundle, but I would like to take full advantages of using Symfony2 and Doctrine. So I would like to have this done in OOP way or using clever DQL query that understands something like:
$em->createQuery("SELECT t FROM MyTestBundle:MyEntity t WHERE t.x = :x")
->setParameter("x", round($x,3));
but being able to rewrite my SQL query from old application to my new bundle is a must. Please, help me finding right solution.