コード例 #1
0
 private function validateRangeBounds(Range $range, $path)
 {
     if (!$this->config->getValueComparison()->isLower($range->getLower(), $range->getUpper(), $this->config->getOptions())) {
         $lowerValue = $range->getViewLower();
         $upperValue = $range->getViewUpper();
         $message = 'Lower range-value {{ lower }} should be lower then upper range-value {{ upper }}.';
         $params = ['{{ lower }}' => strpos($lowerValue, ' ') ? "'" . $lowerValue . "'" : $lowerValue, '{{ upper }}' => strpos($upperValue, ' ') ? "'" . $upperValue . "'" : $upperValue];
         $this->valuesBag->addError(new ValuesError($path, strtr($message, $params), $message, $params));
     }
 }
コード例 #2
0
 /**
  * @param Range                   $range
  * @param Constraint[]|Constraint $constraints
  * @param string                  $subPath
  * @param ValuesBag               $valuesBag
  * @param string[]                $validationGroups
  */
 private function validateRange(Range $range, $constraints, $subPath, ValuesBag $valuesBag, $validationGroups = null)
 {
     $this->validateValue($range->getLower(), $range->getViewLower(), $constraints, $subPath . '.lower', $valuesBag, $validationGroups);
     $this->validateValue($range->getUpper(), $range->getViewUpper(), $constraints, $subPath . '.upper', $valuesBag, $validationGroups);
 }