In case it interests anyone else,  my work-around is to make a model
for the join table which includes
var $belongsTo = array('Mail', 'Tag');

I have then put this code at the end of my Mail controller view
action:

$joinRecords = $this->Mail->MailsTag->findAll(
                      array('MailsTag.mail_id' => $id)
                                         ,array("Tag.id"
                                                 ,"Tag.name","Tag.tagtype"
                                         )
                                );
$mailarray = $this->Mail->read(null, $id);
$mailarray['Tag'] = $joinRecords;
$this->set('mail', $mailarray);

This succeeds in populating and passing the expected  $mail['Tag']
into my (baked) view.
But surely this is an ugly hack compared to the auto-magic solution I
expected with HABTM?


On 20 Nov, 20:17, villas <[EMAIL PROTECTED]> wrote:
> Using the latest 1.2 I cannot get the HABTM working. I think it may be
> a bug (3617).  I have two tables:  Mails and Tags and the join table
> Mails_Tags etc.  When I read the Mails table two select queries fire
> OK.  I tested the SQL queries outside Cake and they returns correct
> results.
>
> However,  whilst the Cake array 'Mail' shows data OK,  the 'Tag' array
> is empty.  That's a bug right?
>
> Can anyone give me a bit of work around code to get my Tag array
> populated because I'm a bit stuck for a solution right now.  Thanks.
--~--~---------~--~----~------------~-------~--~----~
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