src/wcmf/lib/model/mapper/impl/NodeUnifiedRDBMapper.php
protected function addCriteria(SelectStatement $selectStmt, $criteria, $tableName) {
    $parameters = [];
    if ($criteria != null) {
      foreach ($criteria as $criterion) {
        if ($criterion instanceof Criteria) {
          $placeholder = ':'.$tableName.'_'.$criterion->getAttribute();
          list($criteriaCondition, $criteriaPlaceholder) =
                  $this->renderCriteria($criterion, $placeholder, $tableName);
          $selectStmt->where($criteriaCondition, $criterion->getCombineOperator());
          if ($criteriaPlaceholder) {
            $value = $criterion->getValue();
            if (is_array($criteriaPlaceholder)) {
              $parameters = array_merge($parameters, array_combine($criteriaPlaceholder, $value));
            }
            else {
              $parameters[$criteriaPlaceholder] = $value;
            }
          }
        }
        else {
          throw new IllegalArgumentException("The select condition must be an instance of Criteria");
        }
      }
    }
    return $parameters;
  }
protected function addCriteria(SelectStatement $selectStmt, $criteria, $tableName) {
    $parameters = [];
    if ($criteria != null) {
      foreach ($criteria as $criterion) {
        if ($criterion instanceof Criteria) {
          $placeholder = ':'.$tableName.'_'.$criterion->getAttribute();
          list($criteriaCondition, $criteriaPlaceholder) =
                  $this->renderCriteria($criterion, $placeholder, $tableName);
          $selectStmt->where($criteriaCondition, $criterion->getCombineOperator());
          if ($criteriaPlaceholder) {
            $value = $criterion->getValue();
            if (is_array($criteriaPlaceholder)) {
              $parameters = array_merge($parameters, array_combine($criteriaPlaceholder, $value));
            }
            else {
              $parameters[$criteriaPlaceholder] = $value;
            }
          }
        }
        else {
          throw new IllegalArgumentException("The select condition must be an instance of Criteria");
        }
      }
    }
    return $parameters;
  }
protected function addCriteria ( SelectStatement $ selectStmt , $ criteria , $ tableName ) { $ parameters = [ ] ; if ( $ criteria != null ) { foreach ( $ criteria as $ criterion ) { if ( $ criterion instanceof Criteria ) { $ placeholder = ':' . $ tableName . '_' . $ criterion -> getAttribute ( ) ; list ( $ criteriaCondition , $ criteriaPlaceholder ) = $ this -> renderCriteria ( $ criterion , $ placeholder , $ tableName ) ; $ selectStmt -> where ( $ criteriaCondition , $ criterion -> getCombineOperator ( ) ) ; if ( $ criteriaPlaceholder ) { $ value = $ criterion -> getValue ( ) ; if ( is_array ( $ criteriaPlaceholder ) ) { $ parameters = array_merge ( $ parameters , array_combine ( $ criteriaPlaceholder , $ value ) ) ; } else { $ parameters [ $ criteriaPlaceholder ] = $ value ; } } } else { throw new IllegalArgumentException ( "The select condition must be an instance of Criteria" ) ; } } } return $ parameters ; }
Add the given criteria to the select statement
@param $selectStmt The select statement (instance of SelectStatement)
@param $criteria An array of Criteria instances that define conditions on the object's attributes (maybe null)
@param $tableName The table name
@return Array of placeholder/value pairs
Add the given criteria to the select statement