I found this thread when faced with a similar problem.  Look for
Nate's post.

http://groups.google.com/group/cake-php/browse_thread/thread/bef70558f7854732/6363603e04fcee68?lnk=st&q=&rnum=10#6363603e04fcee68

-phrygius

On May 14, 12:51 pm, pete <[EMAIL PROTECTED]> wrote:
> hi,
> im playing around with the hasAndBelongstoMany. thats my table
> structure.
>
> TABLES
>
> projects
>   id
>   projectTitle
>
> tasks
>   id
>   description
>
> projects_tasks
>   project_id
>   task_id
>   start_date
>   end_date
>
> var $hasAndBelongsToMany = array('Task' =>
>                                array('className'    => 'Task',
>                                      'joinTable'    =>
> 'projects_tasks',
>                                      'foreignKey'   => 'project_id',
>                                      'associationForeignKey'=>
> 'task_id',
>                                      'conditions'   => '',
>                                      'order'        => '',
>                                      'limit'        => '',
>                                      'unique'       => true,
>                                      'finderQuery'  => '',
>                                      'deleteQuery'  => '',
>                                )
>                                );
>
> DEBUG
> SELECT Task.id, Task.description from tasks AS Task JOIN
> projects_tasks ON (projects_tasks.project_id = 1 AND
> projects_tasks.task_id = Task.id)
>
> Everything works fine, BUT inside projects_tasks there are 2 more
> fields "start_date", "end_date".
> how can i include them also inside the query?
>
> like this
>
> SELECT Task.id, Task.description,projects_tasks.start_date,
> projects_tasks.end_date from tasks AS Task JOIN projects_tasks ON
> (projects_tasks.project_id = 1 AND projects_tasks.task_id = Task.id)
>
> thanks for helping
> pete


--~--~---------~--~----~------------~-------~--~----~
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