Skip to content

Commit

Permalink
Preparing 0.3.3 release
Browse files Browse the repository at this point in the history
- Fixed bug with Kernel not passing context

Signed-off-by: RJ Garcia <rj@bighead.net>
  • Loading branch information
ragboyjr committed Apr 13, 2017
1 parent 27fd175 commit 88215db
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## 0.3.3 - 2017-04-13

### Fixed

- Kernel bug where context was not passed in

## 0.3.2 - 2017-04-13

### Fixed
Expand Down
1 change: 1 addition & 0 deletions src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function make($validations) {
$this[MessageStore::class],
$this[FormatMessage::class],
$this[FormatViolations::class],
$this['krak.validation.context']->getArrayCopy(),
$validations
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ValidationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function register(Cargo\Container $c) {
$c['krak.validation.default_message'] = "The {{attribute}} is invalid.";
$c['krak.validation.validators'] = new ArrayObject();
$c['krak.validation.context'] = new ArrayObject([
'container' => $c,
'container' => Cargo\toInterop($c),
]);
}
}
6 changes: 4 additions & 2 deletions src/WrappedValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ class WrappedValidator implements FormatMessage, FormatViolations {
private $message_store;
private $format_message;
private $format_violations;
private $context;
private $validations;

private $result;
private $has_run;

public function __construct(ValidationContext $validation_context, MessageStore $message_store, FormatMessage $format_message, FormatViolations $format_violations, $validations) {
public function __construct(ValidationContext $validation_context, MessageStore $message_store, FormatMessage $format_message, FormatViolations $format_violations, array $context, $validations) {
$this->validation_context = $validation_context;
$this->message_store = $message_store;
$this->format_message = $format_message;
$this->format_violations = $format_violations;
$this->context = $context;
$this->validations = $validations;
$this->has_run = false;
}
Expand All @@ -42,7 +44,7 @@ public function messages($data) {
}

public function validate($value, array $ctx = []) {
$violation = $this->validation_context->validate($value, $this->validations, $ctx);
$violation = $this->validation_context->validate($value, $this->validations, array_merge($this->context, $ctx));
$this->has_run = true;
if (!$violation) {
return;
Expand Down

0 comments on commit 88215db

Please sign in to comment.