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

CollectionInputFilter returns always valid for empty collections #4374

Closed
wants to merge 1 commit into from
Closed

Conversation

romankonz
Copy link
Contributor

this pull request adds a required flag to an InputFilterCollection

if you have nested arrays, it's impossible to enfoce at least one entry.

$offers = array(
    array(
        'name' => 't-shirt',
        'prices' => array(
            // i need at least one price! 
                        // array('color' => 'black', 'price' => 149)
        ),
    ),
);

for example - this is very useful for mongodb documents.

@@ -29,6 +29,11 @@ class CollectionInputFilter extends InputFilter
protected $collectionInvalidInputs;

/*
* @var bool
*/
protected $isRequired = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think allowEmpty could be better as name

@ghost ghost assigned weierophinney May 2, 2013
weierophinney added a commit that referenced this pull request May 2, 2013
CollectionInputFilter returns always valid for empty collections
weierophinney added a commit that referenced this pull request May 2, 2013
weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
…ster

CollectionInputFilter returns always valid for empty collections
weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
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.

2 participants