Created
November 10, 2013 22:26
-
-
Save joanteixi/7404748 to your computer and use it in GitHub Desktop.
User repository example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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