Re: Model Design

2008-09-23 Thread aborjinos
thanks for your help martin, i change my query and I remove User models Left join associations and I add gid(group_id) to Session with the help of this I remove User models in my query I add $conditions['GroupPermission.group_id'] = (int)$this->Session- >read('gid'); I remove $conditions['User.i

Re: Model Design

2008-09-23 Thread [EMAIL PROTECTED]
You are right that you can't use User.id when querying Group. And looking at the sql for one of my HABTMs I see that they are indeed two separate queries. My suggestion from yesterday would not work anyway. If you want this the Cake way then I suggest you take a look at Containable behavior. It i

Re: Model Design

2008-09-22 Thread aborjinos
hİ Martin, First so many thanks for your reply, But I can not fix my problem. You are right I am trying to checking if the user has any of the required permissions for a given request. I write GroupPermission model to apply my query as cake-friendly because I can not create Left Join operation

Re: Model Design

2008-09-22 Thread [EMAIL PROTECTED]
Hi, I think doing it Cake-friendly and starting from the sql query do not go together too well. :) Lets see if I got this right: What you want to count is the number of groups that user 1 belongs to where the group gives him the permissions users or users/login. Did I read the sql correctly? It