This comes in handy as Doctrine doesn’t always support all native MySQL commands and functions. Strangely, certain common time and date-related ones like YEAR(), MONTH() and DAY().
The $paramsArr is an array for all placeholders in your standard PDO query.
1 2 3 4 5 6 7 8 9 10 11 12 13 | // Symfony raw queries with placeholders. // Example query: $query = "SELECT * FROM users WHERE status=:status GROUP BY last_name ORDER BY last_name ASC"; $paramsArr=array('status'=>'Active'); $stmt = $this->em->getConnection()->prepare($query); $stmt->execute($paramsArr); $resultsArr=$stmt->fetchAll(); |