Message from discussion
Problem with paged Doctrine in using Doctrine Query -> offset to the query page
MIME-Version: 1.0
Received: by 10.101.68.19 with SMTP id v19mr118289ank.1.1246568303791; Thu, 02
Jul 2009 13:58:23 -0700 (PDT)
Date: Thu, 2 Jul 2009 13:58:23 -0700 (PDT)
X-IP: 201.231.202.246
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-AR; rv:1.9.0.11)
Gecko/2009060215 Firefox/3.0.11,gzip(gfe),gzip(gfe)
Message-ID: <0d41dd89-7094-47e4-af44-47ba92d300a2@y9g2000yqg.googlegroups.com>
Subject: Problem with paged Doctrine in using Doctrine Query -> offset to the
query page
From: Nixs <acron...@gmail.com>
To: doctrine-user <doctrine-user@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
hello. I'm in a weird situation. I need to paginate
and show 10 results per query does pagina.mi correctly.
Then -> offset (10) in the query shows the following 10
results.
The question is what does it correctly. The problem is that when
asks a page, for example the number 500, which is not logically
There, instead of not returning anything, I devulve ALL!
here's the code:
public static function buscarProductos($tiendaId,$cantResultados =
10,$offSet){
$query= Doctrine_Query::create()
->select
('p.id,ip.id,p.precio,p.descripcion,p.titulo,p.moneda,c.id,c.nombre')
->from('Producto p,p.ImagenesProducto ip,p.Categoria
c')
->addWhere('p.tienda_id='.$tiendaId)
->orderBy('p.id desc')
->limit($cantResultados)
->offSet($offSet)
->execute(array(),Doctrine::HYDRATE_ARRAY);
return $query;