Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Feature/unfiltered input data #176

Merged

Conversation

rkeet
Copy link
Contributor

@rkeet rkeet commented Jan 23, 2019

Based on old PR (deprecated) discussion here and Issue description here

Link to last comment with action points (copied below)


@froschdesign @svycka @weierophinney

I haven't forgotten this, just didn't have time this weekend. I hope to get to it this week either during work, an evening or maybe during the coming weekend. However, very busy at the moment.

What I'll try to do the coming days:

Setup up a skeleton application demonstrating issue with plain modules, comments, etc.
Summarize this thread & #168 into a coherent whole
Quick re-read though:

getRawValue(s)() should not be altered from existing functionality to prevent bc-break
Agreed with that getRawValue(s)() returns only known input values, UnfilteredDataInterface should provide solution next to these functions
UnfilteredDataInterface adds functionality instead of modifying existing ones
I'll get into that more by providing the code I mentioned with unit testing - I hope this can wait a few more days (possibly weeks). Like I said, currently very busy, also next to my job. Though holidays soon, so might get something done then...


So I think this might be it

I've done this one TDD (pats own back). I'm however running stretched for time, so I'm hoping to get some feedback for now.

Also, starting a new job next month in Symfony development (my own projects run ZF3/Doctrine), so as I'll have to do some study to get up to speed, ZF3 contributions will regrettably have to go on a back-burner.

@svycka
Copy link
Contributor

svycka commented Jan 23, 2019

And how would I use this? as I understand I could override inputFilter::isValid() and could use this. But still, no way to access unfiltered data in validators and filters would be useful :)

@rkeet
Copy link
Contributor Author

rkeet commented Jan 23, 2019

As what was attempted with the previous setup, it was to make all of the unfiltered data available, not to already implement it in existing functionality. That's why this only adds the property on the InputFilter class and sets it. That makes it available for each to implement/use it at will.

To make it implemented by default, e.g. in the isValid(), I would argue that that would have to be a separate feature. Both the make sure that this one does not break anything and so that a discussion may be held about the (dis-)advantages for a change in current functionality. That's also why I think that would be outside the scope of this PR/feature.

Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I've made a number of comments, but I can address them (and push them back to your branch) during merge. I'll also document the new interface and method when I do.

Thanks, @rkeet!

.gitignore Outdated
@@ -5,3 +5,4 @@ clover.xml
coveralls-upload.json
phpunit.xml
zf-mkdoc-theme.tgz
.idea/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this; this should be in your global gitignore file.

*/
// TODO replace functions when upgrading to > PHP 7.2 as minimum requirement
// public function getUnfilteredData() : array;
public function getUnfilteredData()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO items should be done as annotations:

@todo Replace signature ...

That said: this one is unnecessary; when we move to 7.1 or 7.2 as the minimum supported version, we will be adding return type hints and scalar type hints everywhere we can, as that's a primary motivation for adopting the newer PHP version.

*/
// TODO replace functions when upgrading to > PHP 7.2 as minimum requirement
// public function setUnfilteredData(array $data) : UnfilteredDataInterface;
public function setUnfilteredData($data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here.

* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Use the short-version of this annotation, please (can omit the summary line and the blank line following).

  • Use https links, please, and link to the LICENSE.md in the repository itself.

  • Since this is a new file, only list 2019 for the copyright date.


// TODO replace functions when upgrading to > PHP 7.2 as minimum requirement
// public function getUnfilteredData() : array;
// public function setUnfilteredData(array $data) : UnfilteredDataInterface;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment please.

rkeet and others added 20 commits January 30, 2019 09:27
…nd TODO for when PHP 7.2 is minimum requirement.
…ter for applying UnfilteredDataInterface on BaseInputFilter.
…r. Added property on BaseInputFilter - unfilteredData. Tests pass again. Changed setter return type for PHP 7.2 todo's from array to UnfilteredDataInterface.
…result for getValues and getRawValues as opposed to getUnfilteredData.
Should be in global gitignore, not project
@weierophinney weierophinney force-pushed the feature/unfiltered-input-data branch from 000ba4c to 2fc2d79 Compare January 30, 2019 16:02
@weierophinney weierophinney merged commit 5dd31cc into zendframework:develop Jan 30, 2019
weierophinney added a commit that referenced this pull request Jan 30, 2019
@weierophinney
Copy link
Member

Thanks, @rkeet!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants