Exemple #1
0
 /**
  * {@inheritDoc}
  *
  * @param bool $recursive
  */
 public function merge(BaseInputFilter $inputFilter, $recursive = false)
 {
     foreach ($inputFilter->getInputs() as $name => $input) {
         $this->add($input, $name, $recursive);
     }
     if ($inputFilter instanceof InputFilterInterface) {
         $this->getFilterChain()->merge($inputFilter->getFilterChain());
         $this->getValidatorChain()->merge($inputFilter->getValidatorChain());
     }
     return $this;
 }
Exemple #2
0
 /**
  * Merges the inputs from an InputFilter into the current one
  *
  * @param BaseInputFilter $inputFilter
  *
  * @return self
  */
 public function merge(BaseInputFilter $inputFilter)
 {
     foreach ($inputFilter->getInputs() as $name => $input) {
         $this->add($input, $name);
     }
     return $this;
 }
 public function testGetInputs()
 {
     $filter = new InputFilter();
     $foo = new Input('foo');
     $bar = new Input('bar');
     $filter->add($foo);
     $filter->add($bar);
     $filters = $filter->getInputs();
     $this->assertCount(2, $filters);
     $this->assertEquals('foo', $filters['foo']->getName());
     $this->assertEquals('bar', $filters['bar']->getName());
 }