Yes, I worked it out and I confirm that what's been said here all
comes together just fine. Thank you all!

On Jun 8, 9:45 am, John Andersen <j.andersen...@gmail.com> wrote:
> The find('list') will give you the table ID column and the first
> column thereafter (when no name or title column), so what you got was
> the table ID and the user_id values.
>
> Add a field list to your find options like:
> [code]
> $options = array(
>    'conditions' => array(
>       'ProjectsUser.user_id' => 12
>    ),
>    'fields' => array(
>       'user_id', 'project_id'
>    )
> );
> [/code]
>
> Enjoy,
>    John
>
> On Jun 8, 10:36 am, DrLaban <jbh...@gmail.com> wrote:
>
>
>
> > This comes very close to what I'm looking for, but the first find that
> > I wrote (it isn't an exact copy of your code but should be equal):
>
> > $options = array(
> >             'conditions' => array(
> >                 'ProjectsUser.user_id' => 12
> >             )
> >         );
> > debug($this->Project->ProjectsUser->find('list',$options));
>
> > prints the unique id:s of the matched rows in the projects_users
> > table. Unfortunately, it gives me a list of;
>
> > [0] => 61
> > [1] => 67
>
> > but these id:s don't exist in the Project-table.
>
> > Just a small example of three rows of actual values in the
> > projects_users table;
>
> > ____projects_users____
> > id | user_id | project_id
> > 61| 12        | 2
> > 67 | 12       | 7
> > 68 | 13       | 5
>
> > Now, I get the id-column when doing the suggested find and this I
> > can't match to the Project-table id's. I guess what I want are the
> > project_id's from the project_users table to be able to match this
> > right.
> > I'll go back and fiddle a bit more with this but to come with
> > suggestions.
>
> > This worked almost right out of the box, I'm impressed! Thank you for
> > these and any further comments!
>
> [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to