Bouncy Melons 0.2
declarative style orm
FilterStrict.php
Go to the documentation of this file.
1 <?php
2 namespace bm;
3 
4 class FilterStrict extends FilterComplex {
5 
10  public function createWhere($fields) {
11  $input = $this->getWhere();
12  $re = [];
13  foreach ($fields as $field) {
14  if (empty($input[$field->getName()])) {
15  continue;
16  }
17  if(is_array($input[$field->getName()])) {
18  $re[] = "`".$field->getName()."` IN ('".implode("','",$input[$field->getName()])."')";
19  continue;
20  }
21  $re[] = "`".$field->getName()."` = '".$input[$field->getName()]."'";
22  }
23  return implode(' AND ', $re);
24  }
25 }
createWhere($fields)