Skip to content

Instantly share code, notes, and snippets.

View imluxin's full-sized avatar
😀

Lux imluxin

😀
View GitHub Profile
@imluxin
imluxin / gist:5858665
Last active December 31, 2020 03:33
Get random table row with doctrine DQL in Symfony2
<?php
//
// Theory (for MySQL): http://jan.kneschke.de/projects/mysql/order-by-rand/
//
class QuestionRepository extends EntityRepository
{
public function findOneRandom()
{
$em = $this->getEntityManager();