title: CakePHP3: Generate DB-Query
body: <p>I'm new to CakePHP and I would like to query locations in my DB depending on Google Maps Lat &amp; Lng. How can I add the two <code>andWhere</code> statements only, if <code>$params['bounds']</code> is true?</p>
  
  <pre><code>$params = [
      'bounds' =&gt; 1,
      'swLat' =&gt; ...,
      'swLng' =&gt; ...,
      'neLat' =&gt; ...,
      'neLng' =&gt; ...
  ];
  
  $locations = $this-&gt;Locations
      -&gt;find()
      -&gt;select(['id', 'name', 'lat', 'lng'])
      -&gt;where(['live' =&gt; 1])
      -&gt;andWhere(function ($exp, $q) {
            return $exp-&gt;between('lat', $params['swLat'], $params['neLat']);
      })
      -&gt;andWhere(function ($exp, $q) {
            return $exp-&gt;between('lng', $params['swLng'], $params['neLng']);
      })
      -&gt;order(['name' =&gt; 'ASC']);
  </code></pre>