title: How can I return data found from a contain and left joins in a single object/array in CakePHP 3?
body: <p>I have 3 tables set up in my database so far:</p>
  
  <p>Users / User_Profiles / Addresses</p>
  
  <p>The addresses table is used for storing address both from users and eventually from companies and such in the future. The User_Profiles table has more information about a user that doesn't involve addresses.</p>
  
  <pre><code>Users Table:
  
  id | username | password | etc....
  
  
  User_Profiles:
  
  id | user_id | phone | website | bio | address_id | shipping_address_id
  
  
  Addresses
  
  id | address | city | state | zip | etc...
  </code></pre>
  
  <p>Here's my issue. I want to find a user by id, then return all of his information - his info from user_profiles and his info from addresses (both address_id and shipping_address_id point to the addresses table).</p>
  
  <p>In my model I currently have this:</p>
  
  <pre><code> public function getUserInfo($user_id){
  
       return $this-&gt;find()
          -&gt;contain(['user_profiles'=&gt;['fields'=&gt;['user_id','phone_number', 'website', 'bio', ]]])
          -&gt;where(['id' =&gt; $user_id])
          -&gt;first();
   }
  </code></pre>
  
  <p>This is simple enough and returns my user_profile information. Now I need to join the addresses table (twice, I guess?) for getting the shipping address and the regular address (by shipping_address_id and address_id).</p>
  
  <p>How can I do this? I figured I could use TableRegistry to load in the user_profiles table to store the address_id and shipping_address_id as variables, and then work my way from there, but it seems overly complicated.</p>
  
  <p>Ideally I'd want all of the information returned in an object - the user_profile info along with any addresses associated. </p>