Exemplo n.º 1
0
 /**
  * Check if fields are valid
  *
  * @param array  $data    Current section data
  * @param string $section Current section name
  *
  * @return void
  */
 protected function validateFields(array $data, $section)
 {
     $this->prepareDataToValidate($data);
     parent::validateFields($data, $section);
 }
Exemplo n.º 2
0
 /**
  * Check if field is valid and (if needed) set an error message
  *
  * @param array  $data    Current section data
  * @param string $section Current section name
  *
  * @return void
  */
 protected function validateFields(array $data, $section)
 {
     parent::validateFields($data, $section);
     $cell = $data[self::SECTION_PARAM_FIELDS];
     if (!$this->errorMessages && isset($cell['type'], $cell['value']) && '%' === $cell['type']->getValue() && 100 < (int) $cell['value']->getValue()) {
         $this->addErrorMessage('value', 'The discount should be less than 100%', $data);
     }
 }