CollectionInputFilter returns always valid for empty collections #4374

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

romankonz commented May 1, 2013

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;
@romankonz

romankonz May 1, 2013

Contributor

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

Merge pull request #4374 from RomanKonz/master
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

Merge pull request zendframework/zendframework#4374 from RomanKonz/ma…
…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 join this conversation on GitHub. Already have an account? Sign in to comment