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;
  }