protected function getParameters($criteria, array $parameters) {
    $result = [];
    // flatten conditions
    $criteriaFlat = [];
    foreach ($criteria as $key => $curCriteria) {
      foreach ($curCriteria as $criterion) {
        if ($criterion instanceof Criteria) {
          $mapper = self::getMapper($criterion->getType());
          $valueName = $criterion->getAttribute();
          $attributeDesc = $mapper->getAttribute($valueName);
          if ($attributeDesc) {
            $criteriaFlat[] = $criterion;
          }
        }
      }
    }
    // get parameters in order
    $criteriaValuePosition = [];
    foreach ($parameters as $placeholder => $index) {
      $value = $criteriaFlat[$index]->getValue();
      if (is_array($value)) {
        // criteria has array value
        // initialize position counting for this criteria (defined by index)
        if (!isset($criteriaValuePosition[$index])) {
          $criteriaValuePosition[$index] = 0;
        }
        // set the value from the array
        $result[$placeholder] = $value[$criteriaValuePosition[$index]];
        $criteriaValuePosition[$index]++;
      }
      else {
        // criteria has single value
        $result[$placeholder] = $value;
      }
    }
    return $result;
  }