title: Cakephp 3 Search Function
body: <p>got a question about cakephp3 search function, is it possible to search among two tables/Controllers in a search form?</p>
  <p>this is the codes,  am trying to search from categories name and also products name,  their relationship is products has category id</p>
  <p>this is the code from the Controller</p>
  <pre><code>        $c = $this-&gt;request-&gt;getQuery('c');
  
          if(!empty($c)) {
          $this-&gt;loadModel('Categories');
          
         
          $category = TableRegistry::get('Categories');
  
          $query = $this-&gt;Products-&gt;find()-&gt;contain(['Categories'=&gt;['Products']])
          -&gt;where(['Categories.name LIKE' =&gt;  '%' .   $c. '%']);
         
          }
          $this-&gt;set(compact('c','query'));
  
  
  
          $key = $this-&gt;request-&gt;getQuery('key');
  
          if(!empty($key)) {
         
          $products-&gt;where(['Products.name LIKE ' =&gt; '%'.$key.'%']);
  
          }
      
          $this-&gt;set(compact('key'));
  </code></pre>
  <p>this is from the HTML side,  where i name=&quot;c&quot;, it only search for c and not key,</p>
  <pre><code>      &lt;?php echo $this-&gt;Form-&gt;create(null, ['type' =&gt; 'get', 'valueSources' =&gt; 
        'query'); ?&gt;
  
        &lt;?php echo $this-&gt;Form-&gt;control('search', ['type' =&gt; 'hidden']); ?&gt;
  
        &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;c&quot; placeholder=&quot;Search...&quot;&gt;
  
        &lt;span class=&quot;input-group-append&quot;&gt;
          &lt;button type=&quot;submit&quot;&gt;
  
        &lt;?php echo $this-&gt;Form-&gt;end(); ?&gt;
  </code></pre>
  <p>is there a method to combine both search in a form?</p>
  <p>thank you for your helps</p>