Yet Another HABTM Question (sorry, but I've read the fine manual and
found nothing on this).

To stick on the traditional example:

Post belongsTo User
Post HABTM Tag

$this->data = array(
  'Post' => array(
    'id' => 1,
  ),
  'User' => array(
    'name' => 'John Doe',
  ),
  'Tag' => array(
    'Tag' => array(
      1, 2, 3, 4, 5
    ),
  ),
);

Now if you do:

$this->Post->saveAll($this->data);

Two models are saved: Post and User, but TAGS simply aren't.

The workaround is to do it in two steps:
$this->Post->saveAll($this->data); (saves Post and User)
$this->Post->save($this->data); (saves Post (again!) and Tags)

But this is lame, isn't it? With Cake there should be a smarter way, I
'm sure!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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