I can use a query like this:

SELECT r.* FROM revisions AS r WHERE r.id NOT IN (
   SELECT revision_id FROM user_has_revised WHERE user_id = $__cakeId__$
)

This must work if for each user execute this query. hasAndBelongsToMany
don't work because its fetchs a all relationship of all users on a unique
query.

I opened this ticket https://trac.cakephp.org/ticket/4204, so when I put a
limit its will work.


Thanks.

On Sat, Feb 23, 2008 at 6:28 AM, francky06l <[EMAIL PROTECTED]> wrote:

>
> How did you use the $__cakeId__$ in your finder query ?
>
> On Feb 23, 1:43 am, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> > Sorry ..
> >
> > I wanna do a hasAndBelongsToMany relationship. Sorry for this..
> > I tried to use finderQuery, doing a find (one result) it's ok, but with
> > findAll don't runs...
> >
> > On Fri, Feb 22, 2008 at 10:21 PM, BlenderStyle <[EMAIL PROTECTED]>
> > wrote:
> >
> >
> >
> >
> >
> > > You might be able to do something like this in your Revision model:
> >
> > > function getNegativeRevisions($user_id) {
> > >        $conditions = array('user_id' => '<> '.$user.id);
> > >        return $this->findAll($conditions);
> > > }
> >
> > > Then, in your RevisionsController:
> > > $user_id = '5';
> > > $negative_revisions = $this->Revision->getNegativeRevisions($user_id);
> >
> > > I didn't test that, but it seems logical.
> >
> > > Matt Bowden
> >
> > > On Feb 22, 2:30 pm, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> > > > Hello!
> >
> > > > I have a application that has two main models (User and Revision
> with
> > > > relationship User has many Revision).
> > > > I wanna to get all Revision that this User revised and all Revision
> that
> > > > this User don't revised. There are a way to get this information
> using
> > > the
> > > > relationships?
> >
> > > > Thanks!
> > > > --
> > > > Renan Gonçalves - Software Engineer
> > > > Cell Phone: +55 (11) 8633-6018
> > > > MSN: [EMAIL PROTECTED]
> > > > Web Site: renangoncalves.com
> > > > São Paulo - SP/Brazil
> >
> > --
> > Renan Gonçalves - Software Engineer
> > Cell Phone: +55 (11) 8633-6018
> > MSN: [EMAIL PROTECTED]
> > Web Site: renangoncalves.com
> > São Paulo - SP/Brazil
> >
>


-- 
Renan Gonçalves - Software Engineer
Cell Phone: +55 (11) 8633-6018
MSN: [EMAIL PROTECTED]
Web Site: renangoncalves.com
São Paulo - SP/Brazil

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to