Releases: selective-php/validation
Releases · selective-php/validation
2.1.0
2.0.0
Breaking Changes
- Make all
CakeValidationConverter
method 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::getContentType
Note 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
ValidationResult
use 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
ValidationException
default error code from 0 to 422
Added
- Added
CakeValidationConverter
as 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
TransformerInterface
toResultTransformerInterface
- Renamed
ErrorDetailsTransformer
toErrorDetailsResultTransformer
.
Migration steps from 0.8.0 to 0.9.0:
- Rename the Middleware transformer
ErrorDetailsTransformer
to:ErrorDetailsResultTransformer
. That's it.
$app->add(new ValidationExceptionMiddleware(
$app->getResponseFactory(),
new ErrorDetailsResultTransformer(),
new JsonEncoder()
));
Added
- Added
CakeValidationErrorCollector
for collecting errors from a CakePHP validator - Added
ValidationRegex
as common Regex collection for validation with regex. - More documentation and examples
0.8.0
New Features
- Added Transformer for custom json responses
Breaking Changes
- Added TransformerInterface as to the ValidationExceptionMiddleware constructor as dependency
- Added return types to all classes
- Added final to all classes
- Changed all protected properties to private
- Removed ValidationResult JsonSerializable interface
- Removed ValidationResult::toArray method
- Rename ValidationExceptionMiddleware method getValidation to getValidationResult
- Change minimum php version 7.2
Changes
- Updated depenencies