Exemplo n.º 1
0
 protected function createWhereByCriteria($criteria = array())
 {
     $where = new Where();
     foreach ($criteria as $colname => $value) {
         $colname = Inflector::underscore($colname);
         $element = sprintf('%s = $*', $colname);
         $subWhere = new Where($element, array($value));
         $where->andWhere($subWhere);
     }
     return $where;
 }
Exemplo n.º 2
0
 /**
  * getWhereFrom
  *
  * Build a condition on given values.
  *
  * @access protected
  * @param  array $values
  * @return Where
  */
 protected function getWhereFrom(array $values)
 {
     $where = new Where();
     foreach ($values as $field => $value) {
         $where->andWhere(sprintf("%s = \$*::%s", $this->escapeIdentifier($field), $this->getStructure()->getTypeFor($field)), [$value]);
     }
     return $where;
 }