diff --git a/CHANGELOG.md b/CHANGELOG.md index 1de0b62..4a6430a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file, in reverse ### Added -- Nothing. +- [#16](https://github.com/elie29/validator/issues/16) Do not append none existing item. ### Changed diff --git a/README.md b/README.md index 4dbda00..7a9f5b2 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,14 @@ class MyValueRule extends AbstractRule } ``` +## Validated Context + +Once validate is called, we can use validatedContext method in order to retrieve all validated values from the original +context. + +By default, all keys set in the rules array will be found in the validatedContext array. However, if we don't want to append +non existing keys, we should call appendExistingItemsOnly(true) before validation. + ## Assertion Integration Instead of using assertion key by key, you can validate the whole context and than use [Assertion](https://github.com/beberlei/assert) or [Assert](https://github.com/webmozart/assert) as follow: