Skip to content

Instantly share code, notes, and snippets.

@codephi
Last active September 21, 2015 15:13
Show Gist options
  • Save codephi/30d637bcf89749b828b5 to your computer and use it in GitHub Desktop.
Save codephi/30d637bcf89749b828b5 to your computer and use it in GitHub Desktop.
<?php
$localidades = ['logradouro', 'bairro', 'cidade', 'cep', 'pais'];
$conditions = [];
do{
if(isset($this->request->data[current($localidades)]))
$conditions['l.'.current($localidades)] = '%'.$this->request->data[current($localidades)].'%';
}
while(next($localidades));
/*
'l' => [
'table' => 'localidades',
'type' => 'INNER',
'conditions' => $conditions
]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment