title: CakePHP not setting the $this->Model->id variable
body: <p>I am currently trying to access the data that was just inserted using:</p>
  
  <pre><code>if($this-&gt;User-&gt;save($this-&gt;data))
  {
      $user_id = $this-&gt;User-&gt;id;    #119
      ...
  </code></pre>
  
  <p>But I get the error:</p>
  
  <pre><code>Notice (8): Undefined index:  id [APP/controllers/users_controller.php, line 119]
  Code | Context
  if($this-&gt;User-&gt;save($this-&gt;data))
  {
      $user_id = $this-&gt;data['User']['id'];
  </code></pre>
  
  <p>I don't understand why the save succeeds, but the id is not set?</p>
  
  <p>EDIT:<br>
  So the problem was that because I was using database relations that forced my read to return data from multiple tables, it ended up returning data from multiple tables, so what I really had to do was:</p>
  
  <pre><code>$user = $this-&gt;User-&gt;read();
  $id = $user['User']['id'];
  </code></pre>
  
  <p>rather than:</p>
  
  <pre><code>$user = $this-&gt;User-&gt;read();
  $id = $user['id'];
  </code></pre>