Enable input filter config from annotations to be passed on via composed collections #5456

Merged
merged 4 commits into from Nov 11, 2013

Conversation

Projects
None yet
3 participants
Contributor

carnage commented Nov 9, 2013

Currently, annotations for the input filter are silently lost when using the composed object annotation to compose a collection of objects.

This patch adds a new fieldset class which can take as an option an input filter spec and implements input filter provider interface to allow the form to later retrieve this config for validation and updates the composed object annotation to make use of this new fieldset when composing a collection.

carnage added some commits Nov 8, 2013

@carnage carnage Adds a fieldset which can set and get an input filter specification 08a056d
@carnage carnage Altered element annotation listener to enable input filter composition
Altered element annotation listener to use new fieldset type for collections and to compose the input filter from the composed object into the fieldset
e65eaed
@carnage carnage updated file comment block 0ad869e

@samsonasik samsonasik commented on the diff Nov 9, 2013

library/Zend/Form/InputFilterProviderFieldset.php
+ *
+ * @param array|Traversable $options
+ * @return Element|ElementInterface
+ * @throws Exception\InvalidArgumentException
+ */
+ public function setOptions($options)
+ {
+ parent::setOptions($options);
+
+ if (isset($options['input_filter_spec'])) {
+ $this->setInputFilterSpecification($options['input_filter_spec']);
+ }
+
+ return $this;
+ }
+}
@samsonasik

samsonasik Nov 9, 2013

Contributor

add new line after } for eof ending

@samsonasik samsonasik commented on the diff Nov 9, 2013

tests/ZendTest/Form/InputFilterProviderFieldsetTest.php
+ }
+
+ public function testCanSetInputFilterSpecViaOptions()
+ {
+ $filterSpec = array('filter'=>array('filter_options'));
+
+ $this->fieldset->setOptions(array('input_filter_spec'=>$filterSpec));
+ $this->assertEquals($filterSpec, $this->fieldset->getInputFilterSpecification());
+ }
+
+ public function testFilterSpecIsInitiallyEmpty()
+ {
+ $this->assertEmpty($this->fieldset->getInputFilterSpecification());
+ }
+
+}
@samsonasik

samsonasik Nov 9, 2013

Contributor

add new line after } for eof ending

@weierophinney weierophinney added a commit that referenced this pull request Nov 11, 2013

@weierophinney weierophinney Merge branch 'feature/5456' into develop
Close #5456
be9638e

weierophinney merged commit 78046b9 into zendframework:develop Nov 11, 2013

1 check failed

default The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment