title: Cakephp 3 dynamically build contain
body: <p>How can I dynamically build the contain in the new cakephp 3 query builder. This is what I have now:</p>
  
  <pre><code>$query = $dbTable-&gt;find()
                  -&gt;select($contain['select']['fields'])
                  -&gt;contain(function($q) use($array,$contain){
                        $new = [];
                        foreach($array as $v){
                          if(isset($contain['contains'][$v])){
                            $fields = $contain['contains'][$v];
                            $new[$v] = $q-&gt;select($fields);
                           }
                        }
                        return $new;
                    });
  </code></pre>
  
  <p>But I am getting several errors with this:</p>
  
  <pre><code>Warning (2): Illegal offset type in isset or empty [CORE\src\ORM\EagerLoader.php, line 198]
  Warning (2): strpos() expects parameter 1 to be string, object given [CORE\src\ORM\EagerLoader.php, line 203]
  Warning (2): Illegal offset type [CORE\src\ORM\EagerLoader.php, line 223]
  Warning (2): Illegal offset type [CORE\src\ORM\EagerLoader.php, line 224]
  </code></pre>