Hello,

I seem to have particular problems with negative thinking ;-)
Well, here is the problem: I use a many to many relationship to 
define group membership of users. So I have three tables 'users', 
'groups' and 'groupmappings' and a relationship definition that looks 
like this (within the Users class):
    groups => {
        type      => 'many to many',
        map_class => 'Groupmappings',
    },

but how can I negate this, so I get all the groups, the user is not a 
member of?
Of course I can do it by hand, do a 'Groups->get_groups()', extract 
the ids then use the above many to many relationship for the groups 
of the user, extract the ids, then do a diff of the two id-lists. But 
this doesn't look like the right way to go. After all, it looks like 
a simple SQL problem (tested):
select id from groups where not exists (select * from groupmappings 
where user_id = $self->id and group_id = id);
Now, I have no idea how to express this in relationship terms.
Or should I use the get_groups() manager method:
my $not_in_groups = Groups->get_groups(
    clauses => ["not exists (select * from groupmappings where 
user_id = $userid and group_id = id)"],
);
Or can this be done with query args?

As you can see lots of questions, no showstopper since I found ways 
to get my group list but I think there are ways to do it the RDBO way 
and I would like to learn them...

Thanks,
Michael




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to