title: Cake php multimodel form post parameters
body: <p>I'm a cakephp newbie, and I was ordered to use the 1.3 version.
  I can't understand (and both guides and api docs don't tell it) how I could create an HABTM association in a POST request.</p>
  
  <p>I'm trying to create a wine, that could be made of many vines. For example I'm creating a "soave" whine, that is made of "garganega" and "chardonnay" vines.</p>
  
  <p>How should the POST params should be?</p>
  
  <p>Given theses <strong>models</strong></p>
  
  <pre><code>class Wine extends AppModel{
      var $hasAndBelongsToMany = array(
          'Vine' =&gt; array(
              'className' =&gt; 'Vine',
              'joinTable' =&gt; 'wine_vines',
              'foreignKey' =&gt; 'wine_id',
              'associationForeignKey' =&gt; 'vine_id',
              'with' =&gt; 'WineVine',
          ),
      );
  }
  
  class Vine extends AppModel{
      var $hasAndBelongsToMany = array(
          'Wine' =&gt; array(
              'className' =&gt; 'Wine',
              'joinTable' =&gt; 'wine_vines',
              'foreignKey' =&gt; 'vine_id',
              'associationForeignKey' =&gt; 'wine_id',
              'with' =&gt; 'WineVine',
          ),
      );        
  }
  
  class WineVine extends AppModel{
      var $name = "WineVine";
  
      public $belongsTo = array("Wine", "Vine");
  }
  </code></pre>
  
  <p>I tried a POST like this:</p>
  
  <pre><code>Array
  (
      [Wine] =&gt; Array
          (
              [denomination] =&gt; Soave DOP
              [fantasy_name] =&gt; 
              [kind] =&gt; White
          )
  
      [Vine] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [name] =&gt; garganega
                  )
              [2] =&gt; Array
                  (
                      [name] =&gt; chardonnay
                  )
  
          )
  
  )
  </code></pre>
  
  <p>but it does not perform any inserts in vine table, only in wine.
  Here's the log:</p>
  
  <pre><code>2   INSERT INTO `wines` (`denomination`, `fantasy_name`, `kind`, `modified`, `created`) VALUES ('', '', '', '2013-10-25 17:27:14', '2013-10-25 17:27:14')       1       55
  3   SELECT LAST_INSERT_ID() AS insertID     1   1   1
  4   SELECT `WineVine`.`vine_id` FROM `wine_vines` AS `WineVine` WHERE `WineVine`.`wine_id` = 2      0   0   1
  5   SELECT `Vine`.`id`, `Vine`.`name`, `Vine`.`created`, `Vine`.`modified` FROM `vines` AS `Vine` WHERE 1 = 1       5   5   0
  6   SELECT `Wine`.`id`, `Wine`.`denomination`, `Wine`.`fantasy_name`, `Wine`.`kind`, `Wine`.`created`, `Wine`.`modified`, `Wine`.`producer_id`, `WineVine`.`id`, `WineVine`.`wine_id`, `WineVine`.`vine_id`, `WineVine`.`created`, `WineVine`.`modified` FROM `wines` AS `Wine` JOIN `wine_vines` AS `WineVine` ON (`WineVine`.`vine_id` IN (1, 2, 3, 4, 5) AND `WineVine`.`wine_id` = `Wine`.`id`)
  </code></pre>