Skip to content

Releases: selective-php/validation

2.1.0

09 Sep 22:05
Compare
Choose a tag to compare

2.0.0

04 Sep 23:12
Compare
Choose a tag to compare

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

12 Feb 10:38
9c3d3e1
Compare
Choose a tag to compare

Added

  • Add Encoder content type. See #9. Thanks to @eugene-borovov
  • Added method: EncoderInterface::getContentType Note that this would be a breaking change for the EncoderInterface, 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

11 Feb 21:56
Compare
Choose a tag to compare

Added

  • Use exception code as HTTP status. See #8. Thanks to @eugene-borovov
  • Add ValidationRegex::UUID
  • Add ValidationRegex::POSITIVE_FLOAT

Fixed

  • Fix ValidationRegex::POSTAL_CODE

Removed

  • Remove ValidationRegex::POSTAL_CODE_CANADA

0.12.1

10 Feb 06:13
Compare
Choose a tag to compare

Added

  • Add CakeValidationFactory

0.12.0

07 Dec 18:02
Compare
Choose a tag to compare

Added

  • Add PHP 8 support

Breaking Changes

  • In ValidationException the ValidationResult is optional now
  • Add missing type declaration to ValidationError::setCode

0.11.0

18 Jun 21:23
Compare
Choose a tag to compare

Breaking Changes

  • Replaced collectors with converters
    • To convert CakePHP errors into a ValidationResult use this: $validationResult = CakeValidationConverter::createValidationResult($validator->validate($formData));
  • Renamed method ValidationResult::isFailed() to ValidationResult::fails()
  • Renamed ValidationResult::isSuccess() to ValidationResult::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

30 May 23:18
Compare
Choose a tag to compare

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

17 May 14:10
49ca08d
Compare
Choose a tag to compare

Breaking Changes

  • Renamed TransformerInterface to ResultTransformerInterface
  • Renamed ErrorDetailsTransformer to ErrorDetailsResultTransformer.

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

18 Apr 19:17
Compare
Choose a tag to compare

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