title: warning : creating default object from empty value in cakephp
body: <p>I am working on CakePHP 3.2</p>
  
  <p>I have this function to find product types if exists</p>
  
  <pre><code>if ($product['product_type'] != null) {
     $getProductType = $this-&gt;ProductTypes-&gt;find()
       -&gt;where(['title LIKE' =&gt; '%'.$product['product_type'].'%'])
       -&gt;first();
  
     debug($product['product_type']);   // this is not empty
     debug($getProductType);            // this shows 'id' =&gt; 1 in array
     debug($getProductType-&gt;id);        // this shows 1
  
     if (!empty($getProductType)) {
        $p-&gt;product_type_id = $getProductType-&gt;id;           // line 11
        $p-&gt;subcategory_id = $getProductType-&gt;subcategory_id;
        $p-&gt;category_id = $getProductType-&gt;category_id;
  
        return $this-&gt;saveNewBulkProduct($product, $p-&gt;category_id, $p-&gt;subcategory_id, $p-&gt;product_type_id);
     }
  }
  </code></pre>
  
  <p><strong>But this is giving warning as</strong></p>
  
  <pre><code>Creating default object from empty value on line 11
  </code></pre>
  
  <blockquote>
    <p><strong>Edit 2 Output of <code>print_r($getProductType)</code></strong></p>
  </blockquote>
  
  <pre><code>App\Model\Entity\ProductType Object 
  ( 
     [id] =&gt; 3 
     [category_id] =&gt; 1
     ....
  )
  </code></pre>