Releases: selective-php/validation
Releases · selective-php/validation
2.2.0
2.1.0
Changed
2.0.0
Breaking Changes
- Make all
CakeValidationConvertermethod non static
Migration from v1 to v2
use Selective\Validation\Converter\CakeValidationConverter;
// ...
// Old
$validationResult = CakeValidationConverter::createValidationResult($errors);
// New
$validationResult = (new CakeValidationConverter())->createValidationResult($errors);Added
- Add
ValidationConverterInterface
Removed
- Dropped support for
symfony/validator(not used)
1.1.0
Added
- Add Encoder content type. See #9. Thanks to @eugene-borovov
- Added method:
EncoderInterface::getContentTypeNote that this would be a breaking change for theEncoderInterface, but version 1.0.0 just released and the number of downloads are 0, so this change will be added to version 1.x
1.0.0
0.12.1
0.12.0
0.11.0
Breaking Changes
- Replaced collectors with converters
- To convert CakePHP errors into a
ValidationResultuse this:$validationResult = CakeValidationConverter::createValidationResult($validator->validate($formData));
- To convert CakePHP errors into a
- Renamed method
ValidationResult::isFailed()toValidationResult::fails() - Renamed
ValidationResult::isSuccess()toValidationResult::success() - Set
ValidationExceptiondefault error code from 0 to 422
Added
- Added
CakeValidationConverteras CakePHP validator converter - Add symfony validator support. See
SymfonyValidationConverter.
0.10.0
Breaking Changes
-
Removed ValidationResult methods
- getMessage
- setMessage
- getCode
- setCode
- addValidationError
-
Change ResultTransformerInterface
- Added optional ValidationException as second parameter to extract the error message and error code from the exception (and not from the ValidationResult anymore).
Migration
Old
if ($validationResult->isFailed()) {
$validationResult->setMessage('Please check your input');
throw new ValidationException($validationResult);
}New
if ($validationResult->isFailed()) {
throw new ValidationException('Please check your input', $validationResult);
}0.9.0
Breaking Changes
- Renamed
TransformerInterfacetoResultTransformerInterface - Renamed
ErrorDetailsTransformertoErrorDetailsResultTransformer.
Migration steps from 0.8.0 to 0.9.0:
- Rename the Middleware transformer
ErrorDetailsTransformerto:ErrorDetailsResultTransformer. That's it.
$app->add(new ValidationExceptionMiddleware(
$app->getResponseFactory(),
new ErrorDetailsResultTransformer(),
new JsonEncoder()
));Added
- Added
CakeValidationErrorCollectorfor collecting errors from a CakePHP validator - Added
ValidationRegexas common Regex collection for validation with regex. - More documentation and examples