title: CakePHP use 3 models with saveAll
body: <p>I have following situation:</p>
  
  <p>I'm developing an address-application to store the details of our clients.</p>
  
  <p>I've got the following db-structure:</p>
  
  <pre><code>Clients hasMany Addresses
  Addresses belongsTo Client
  Addresses hasMany AddressEmails and AddressPhones
  </code></pre>
  
  <p>If someone now adds a new client, his primary address with 1 email and 1 phonenumber should be saved.</p>
  
  <p>That works partly very good if I do this in the add-view of the client with the following code and call the saveAll-method in the client-controller:</p>
  
  <pre><code> &lt;?php
    echo $this-&gt;Form-&gt;input('client_group_id');
    echo $this-&gt;Form-&gt;input('company');
    echo $this-&gt;Form-&gt;input('firstname');
    echo $this-&gt;Form-&gt;input('lastname');
    echo $this-&gt;Form-&gt;input('www');
    echo $this-&gt;Form-&gt;input('Address.0.is_standard', array('type' =&gt; 'hidden', 'value' =&gt; '1'));
    echo $this-&gt;Form-&gt;input('Address.0.street');
    echo $this-&gt;Form-&gt;input('Address.0.zip');
    echo $this-&gt;Form-&gt;input('Address.0.city');
   ?&gt;
  </code></pre>
  
  <p>But I have no idea how to save the email and the phone number over this view. Tried thinks like AddressEmail.0.email but that didn't work.</p>
  
  <hr>
  
  <p>Got it:</p>
  
  <p>With Nik's posted solution it's working fine, I'm now calling $this->Client->Address->saveAll($this->data) but had to adjust my add-view like this:</p>
  
  <pre><code>&lt;?php
      echo $this-&gt;Form-&gt;input('client_group_id');
      echo $this-&gt;Form-&gt;input('company');
      echo $this-&gt;Form-&gt;input('firstname');
      echo $this-&gt;Form-&gt;input('lastname');
      echo $this-&gt;Form-&gt;input('www');
      echo $this-&gt;Form-&gt;input('Address.is_standard', array('type' =&gt; 'hidden', 'value' =&gt; '1'));
      echo $this-&gt;Form-&gt;input('Address.street');
      echo $this-&gt;Form-&gt;input('Address.zip');
      echo $this-&gt;Form-&gt;input('Address.city');
      echo $this-&gt;Form-&gt;input('AddressEmail.0.type', array('type' =&gt; 'hidden', 'value' =&gt; 'Standard'));
      echo $this-&gt;Form-&gt;input('AddressEmail.0.email');
      echo $this-&gt;Form-&gt;input('AddressPhone.0.type', array('type' =&gt; 'hidden', 'value' =&gt; 'Standard'));
      echo $this-&gt;Form-&gt;input('AddressPhone.0.number');
  ?&gt;
  </code></pre>
  
  <p>Since I'm now calling the saveAll()-method from the Address-Model the zeros are not needed anymore!</p>