You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 8, 2020. It is now read-only.
then AnnotationBuilder fails to build the form with the exception: Zend\InputFilter\Factory::createInput expects an array or Traversable; received "boolean"
I didn't find any in depth documentation / FAQ / tutorial about using ComposedObject with other annotations but it seems as if:
Form object that is built with AnnotationBuilder does not take Required and AllowEmpty into consideration when ComposedObject is present.
When using AllowEmpty / Required(false) with ComposedObject, the composed object specified gets validated regardless if it's present (and obviously fails if it's not).
Switching order of annotations confuses Zend\Form\Factory::createInputFilter(). $inputFilterSpecification argument contains the SomeObject definition but it also has required = false and allow_empty = true keys. Iterating inputFilterSpecification passes $value = false to Zend\Form\Factory::createInput($value) which refuses to work with false value.
Sure, I will evaluate if error occurs with 2.5.5 and will split second error to another issue. Can you confirm that it should work like I described above?
My question is rather about ComposedObject + Required annotation. As ComposedObject is used as a fieldset annotation, I later realized it can be a fieldset limitation. I'm not sure if there is a concept of "optional fieldset" in ZF2. Correct me if I'm wrong, but you cannot mark a fieldset optional, you rather don't list them in validationGroup.
Again, this is as I remembered it when I dug into this in May. Correct me if I'm wrong.
First of all, what is the expected behaviour of having a field in dynamically built form, annotated like
Should the field then be optional but
SomeObject
validated fully when present?Second part is more of a bug I think. When you take above annotation and switch the order of
@Annotation
likethen AnnotationBuilder fails to build the form with the exception:
Zend\InputFilter\Factory::createInput expects an array or Traversable; received "boolean"
I didn't find any in depth documentation / FAQ / tutorial about using
ComposedObject
with other annotations but it seems as if:AnnotationBuilder
does not takeRequired
andAllowEmpty
into consideration whenComposedObject
is present.AllowEmpty
/Required(false)
withComposedObject
, the composed object specified gets validated regardless if it's present (and obviously fails if it's not).Zend\Form\Factory::createInputFilter()
.$inputFilterSpecification
argument contains theSomeObject
definition but it also hasrequired = false
andallow_empty = true
keys. IteratinginputFilterSpecification
passes$value = false
toZend\Form\Factory::createInput($value)
which refuses to work with false value.If my explaination is vague, maybe the example could be helpful stackoverflow question
The text was updated successfully, but these errors were encountered: