Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Problem with paged Doctrine in using Doctrine Query -> offset to the query page

View Parsed - Show only message text

MIME-Version: 1.0
Received: by 10.100.95.15 with SMTP id s15mr140860anb.26.1246576975768; Thu, 
	02 Jul 2009 16:22:55 -0700 (PDT)
Date: Thu, 2 Jul 2009 16:22:55 -0700 (PDT)
In-Reply-To: <bd2145680907021414u649db2ecoff28d194451ce6fd@mail.gmail.com>
X-IP: 201.231.202.246
References: <0d41dd89-7094-47e4-af44-47ba92d300a2@y9g2000yqg.googlegroups.com> 
	<bd2145680907021414u649db2ecoff28d194451ce6fd@mail.gmail.com>
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: <3702724b-8286-41f2-82dd-f992a5e67178@t13g2000yqt.googlegroups.com>
Subject: Re: 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: quoted-printable

SQL queries

   1. SELECT DISTINCT p2.id FROM producto p2 LEFT JOIN
imagenes_producto i2 ON p2.id =3D i2.producto_id LEFT JOIN categoria c2
ON p2.categoria_id =3D c2.id WHERE p2.tienda_id =3D 1 ORDER BY p2.id desc
LIMIT 4 OFFSET 13

2. SELECT p.id AS p__id, p.precio AS p__precio, p.descripcion AS
p__descripcion, p.titulo AS p__titulo, p.moneda AS p__moneda, i.id AS
i__id, c.id AS c__id, c.nombre AS c__nombre FROM producto p LEFT JOIN
imagenes_producto i ON p.id =3D i.producto_id LEFT JOIN categoria c ON
p.categoria_id =3D c.id WHERE p.tienda_id =3D 1 ORDER BY p.id desc


I use sfDoctrinePager exactly the same problem occurs


On 2 jul, 18:14, Szabolcs Heilig <szabolcs.hei...@gmail.com> wrote:
> Hello,
>
> To get closer tho know what does Doctrine in that case,
> (your offset is out of the bound) check the generated SQL with:
>
> echo $query->getSql();
>
> You can check the generated SQL with that step.
>
> 2009/7/2 Nixs <acron...@gmail.com>
>
>
>
> > 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 =3D
> > 10,$offSet){
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$query=3D Doctrine_Query::create()
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0->select
> > ('p.id,ip.id,p.precio,p.descripcion,p.titulo,p.moneda,c.id,c.nombre')
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0->from('Producto p,p.ImagenesProducto ip=
,p.Categoria
> > c')
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0->addWhere('p.tienda_id=3D'.$tiendaId)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0->orderBy('p.id desc')
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0->limit($cantResultados)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0->offSet($offSet)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0->execute(array(),Doctrine::HYDRATE_ARRA=
Y);
>

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google