/** * Adds a field error if the {@link $value} given is empty * * The field error will be added with a failureCode of 'required' * * @param string $fieldResolved The machine readable field identifier * @param string $fieldType 'field', 'meta', or 'tag' * @param string $fieldTitle The human readable field name * @param string $value The value to check * @param ValidationExpression $ve The ValidationExpression used to validate the value * @param string $message (optional) A default error message to display if one cannot be located. * * @return this */ public function rejectIfInvalid($fieldResolved, $fieldType, $fieldTitle, $value, ValidationExpression $ve, $message = '') { if (!$ve->isValid($value)) { $this->addFieldError($ve->getFailureCode(), $fieldResolved, $fieldType, $fieldTitle, $value, $message == '' ? "{$fieldTitle} {$ve->getFailureMessage()}." : $message); } return $this; }