Re: Does anybody know how can I limit the join table fields when I user joins condition?

2009-04-01 Thread joshua
Sorry, the example is not appropriate. How about this? Tag table: id | name Task table: id | user_id | name I want get all the tasks of a tag. On Thu, Apr 2, 2009 at 12:31 AM, francky06l wrote: > > Looking at your user/task description Isn'it a simple User hasMany > Task ? In such case, conta

Re: Does anybody know how can I limit the join table fields when I user joins condition?

2009-04-01 Thread francky06l
Looking at your user/task description Isn'it a simple User hasMany Task ? In such case, containable can do the job .. unless I am missing something On Apr 1, 2:58 pm, joshua wrote: > Yes, we can use containable to get the task's users. But if there is a user > , I want to find all the tasks he

Re: Does anybody know how can I limit the join table fields when I user joins condition?

2009-04-01 Thread joshua
Yes, we can use containable to get the task's users. But if there is a user , I want to find all the tasks he owns. How can I do? User table: id | name Task table: id | user_id | name We can't count on containable to help us to find the relate tasks. And I count on 'join' to help me to do this.

Re: Does anybody know how can I limit the join table fields when I user joins condition?

2009-03-31 Thread Amit
I highly recommend checking out the Containable behavior: http://book.cakephp.org/view/474/Containable It will simplify this code and let you easily add fields. On Mar 31, 8:28 am, joshua wrote: > For example: > One task has many users. > >         $condition = array()

Re: Does anybody know how can I limit the join table fields when I user joins condition?

2009-03-31 Thread francky06l
Use the 'fields' options for your field and add 'User.name' in it maybe ? hth On Mar 31, 3:28 pm, joshua wrote: > For example: > One task has many users. > >         $condition = array(); >         $condition['joins'] = array( >             array( >                 'tab

Does anybody know how can I limit the join table fields when I user joins condition?

2009-03-31 Thread joshua
For example: One task has many users. $condition = array(); $condition['joins'] = array( array( 'table' => 'users', 'alias' => 'User', 'type' => 'inner', 'foreignKey' => 'user_id',