I think better solution would be to make a one query from this two and then paginate as in admin generator.
On 11 bře, 21:07, Javier Garcia <tirengar...@gmail.com> wrote: > Hi, > > to get the friends of a user i have a table like this: > > AmigoUsuario: > columns: > user1_id: > type: integer(4) > user2_id: > type: integer(4) > estado: > type: integer > default: 0 > relations: > User1: > class: Usuario > local: user1_id > foreignAlias: AmigosUsuario > onDelete: CASCADE > User2: > class: Usuario > local: user2_id > foreignAlias: AmigosUsuario > onDelete: CASCADE > > I have also these queries below to get friends of a user (I have two > queries because the id of the user can be stored as User1 or User2). > These are the queries: > > // hemos tenido que hacer dos querys porque la amistad puede > estar definida > // en cualquiera de la dos direcciones (as X->Y o as Y->X) > $q1 = Doctrine_Query::create() > ->from('Usuario u') > ->leftJoin('u.AmigoUsuario a ON u.id = a.user2_id') > ->where("a.user1_id = ?", $id) > ->andWhere("a.estado LIKE ?", 1); > > $q2 = Doctrine_Query::create() > ->from('Usuario u') > ->leftJoin('u.AmigoUsuario a ON u.id = a.user1_id') > ->where("a.user2_id = ?", $id) > ->andWhere("a.estado LIKE ?", 1); > > Now i want to paginate the results. What is your advice? > > Regards > > Javi -- 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