You can use:
Query::setMaxResults($maxResults)
Query::setFirstResult($offset)

http://www.doctrine-project.org/docs/orm/2.0/en/reference/dql-doctrine-query-language.html#first-and-max-result-items-dql-query-only


On 8 juin, 08:54, Thomas <thomas.pei...@gmail.com> wrote:
> Hi all,
>
> I didn't found in the doctrine documentation how to limit my results when
> i'm fetching all my news.
>
> I want to limit my results with only 5 news (like in SQL LIMIT 0,5).
>
> I've done this :
>
> $news = new News();
> $news = $this->get('doctrine')
> ->getEntityManager()
> ->getRepository('CompanySiteBundle:News')
> ->findAll();
>
> It's work fine but i have all my news, and i don't really want to have SQL
> order in my Controller..
>
> Thanks !

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to