Skip to content

Instantly share code, notes, and snippets.

@joanteixi
Created November 10, 2013 22:26
Show Gist options
  • Save joanteixi/7404748 to your computer and use it in GitHub Desktop.
Save joanteixi/7404748 to your computer and use it in GitHub Desktop.
User repository example
<?php
namespace nemmi\WebBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NoResultException;
use Doctrine\ORM\Tools\Pagination\Paginator;
use Doctrine\ORM\AbstractQuery;
/**
* UserRepository
*
*/
class UserRepository extends EntityRepository
{
public function findLastUsers()
{
$dql = 'SELECT u FROM nemmiWebBundle:User u
ORDER BY u.id DESC';
$query = $this->getEntityManager()->createQuery($dql);
return $query->execute();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment