web-serviceszend-frameworkswaggerzend-inputfilter

Zend InputFilter:


I have 2 objects $object1 and $object2. Each object have firstname and lastname like this:

{
    "fistename": "string",
    "lastename": "string",
}

In my input of Web Service (WS), I have an array of this 2 objects:

[object1, $object2] 

OR

[
    {
        "fistename": "string",
        "lastename": "string",
    },
    {
        "fistename": "string",
        "lastename": "string",
    }
]

How can I develop this with Zend InputFilter.

Thank you


Solution

  • I use \Zend\InputFilter\CollectionInputFilter.

    $data = new \Zend\InputFilter\CollectionInputFilter();
    $x->setInputFilter($data);
    $this->add($x);