title: How to receive data from associated table in CakePHP 3.x as object(currently receiving as an array)
body: <p>I'm trying to associate tables using <code>belongsTo</code>:
  <a href="http://book.cakephp.org/3.0/en/orm/associations.html#belongsto-associations" rel="nofollow">http://book.cakephp.org/3.0/en/orm/associations.html#belongsto-associations</a></p>
  
  <p>I have this code in my </p>
  
  <blockquote>
    <p>JobsController.php:</p>
  </blockquote>
  
  <pre><code>class JobsController extends AppController
  {
      public $name = 'Jobs';
  
      /**
       * Index method
       *
       * @return void
       */
      public function index()
      {
          //Get Jobs info
          $getjobs = TableRegistry::get('Jobs');
          $jobs = $getjobs-&gt;find('all')-&gt;contain(['Types']);
          $this-&gt;set('jobs',$jobs);
      }
  }
  </code></pre>
  
  <blockquote>
    <p>JobsTable.php:</p>
  </blockquote>
  
  <pre><code>&lt;?php
  
  namespace App\Model\Table;
  
  use Cake\ORM\Table;
  
  class JobsTable extends Table
  {
      public function initialize(array $config)
      {
          $this-&gt;table('jobs');
          $this-&gt;belongsTo('types', [
              'foreignKey' =&gt; 'type_id',
              'joinType' =&gt; 'INNER',
          ]);
      }
  
  }
  </code></pre>
  
  <blockquote>
    <p>TypesTable.php:</p>
  </blockquote>
  
  <pre><code>&lt;?php
  
  namespace App\Model\Table;
  
  use Cake\ORM\Table;
  
  class TypesTable extends Table
  {
      public function initialize(array $config)
      {
          $this-&gt;table('types');
      }
  
  }
  </code></pre>
  
  <p>And I'm receiving needed data, but instead of receiving it as an object, as written in manual, I'm receiving it as an array, and It's not what is supposed to be.</p>
  
  <blockquote>
    <p>So now I'm accessing it like this(because its an array with name <strong>types</strong>):</p>
  </blockquote>
  
  <pre><code>&lt;?php foreach($jobs as $job) : ?&gt;
          &lt;?php var_dump($job-&gt;types['color']); ?&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <blockquote>
    <p>But instead it supposed to be like this(according to docs it should be an object with name <strong>type</strong>):</p>
  </blockquote>
  
  <pre><code>&lt;?php foreach($jobs as $job) : ?&gt;
      &lt;?php var_dump($job-&gt;type-&gt;color); ?&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>What am I doing wrong?</p>