This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging develop to master in preparation for 2.10.0 release.
- Loading branch information
Showing
10 changed files
with
231 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Unfiltered Data | ||
|
||
> Since 2.10.0 | ||
On input filters, there are several methods for retrieving the data: | ||
|
||
- `getValues()` will return all known values after filtering them. | ||
- `getRawValues()` will return all known values with no filtering applied. | ||
- `getUnknown()` returns the set of all unknown values (values with no | ||
corresponding input or input filter). | ||
|
||
At times, particularly when working with collections, you may want access to the | ||
complete set of original data provided to the input filter. This can be | ||
accomplished by merging the sets returned by `getRawValues()` and | ||
`getUnknown()` when working with normal input filters, but this approach breaks | ||
down when working with collections. | ||
|
||
Version 2.10.0 introduces a new interface, `Zend\InputFilter\UnfilteredDataInterface`, | ||
for dealing with this situation. `Zend\InputFilter\BaseInputFilter`, which | ||
forms the parent class for all shipped input filter implementations, implements | ||
the interface, which consists of the following methods: | ||
|
||
```php | ||
interface UnfilteredDataInterface | ||
{ | ||
/** | ||
* @return array|object | ||
*/ | ||
public function getUnfilteredData() | ||
{ | ||
return $this->unfilteredData; | ||
} | ||
|
||
/** | ||
* @param array|object $data | ||
* @return $this | ||
*/ | ||
public function setUnfilteredData($data) | ||
{ | ||
$this->unfilteredData = $data; | ||
return $this; | ||
} | ||
} | ||
``` | ||
|
||
The `setUnfilteredData()` method is called by `setData()` with the full `$data` | ||
provided to that method, ensuring that `getUnfilteredData()` will always provide | ||
the original data with which the input filter was initialized, with no filtering | ||
applied. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
docs_dir: docs/book | ||
site_dir: docs/html | ||
pages: | ||
- index.md | ||
- Intro: intro.md | ||
- Home: index.md | ||
- Introduction: intro.md | ||
- Reference: | ||
- Specifications: specs.md | ||
- Files: file-input.md | ||
- "Optional Input Filters": optional-input-filters.md | ||
- "Unfiltered Data": unfiltered-data.md | ||
site_name: zend-inputfilter | ||
site_description: zend-inputfilter | ||
repo_url: 'https://github.com/zendframework/zend-inputfilter' | ||
copyright: 'Copyright (c) 2016-2017 <a href="http://www.zend.com/">Zend Technologies USA Inc.</a>' | ||
copyright: 'Copyright (c) 2016-2019 <a href="http://www.zend.com/">Zend Technologies USA Inc.</a>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-inputfilter for the canonical source repository | ||
* @copyright Copyright (c) 2019 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @license https://github.com/zendframework/zend-inputfilter/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace Zend\InputFilter; | ||
|
||
/** | ||
* Ensures Inputs store unfiltered data and are capable of returning it | ||
*/ | ||
interface UnfilteredDataInterface | ||
{ | ||
/** | ||
* @return array|object | ||
*/ | ||
public function getUnfilteredData(); | ||
|
||
/** | ||
* @param array|object $data | ||
* @return $this | ||
*/ | ||
public function setUnfilteredData($data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters