src/wcmf/lib/model/ObjectQuery.php
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;
  }
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;
  }
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 ; }
Get an array of parameter values for the given criteria
@param $criteria An array of Criteria instances that define conditions on the object's attributes (maybe null)
@param $parameters Array defining the parameter order
@return Array
Get an array of parameter values for the given criteria