/**
  * {@inheritDoc}
  */
 public function setValue($value)
 {
     if ($value instanceof \Traversable) {
         $value = ArrayUtils::iteratorToArray($value);
     } elseif ($value == null) {
         return parent::setValue(array());
     } elseif (!is_array($value)) {
         $value = (array) $value;
     }
     return parent::setValue(array_map(array($this->getProxy(), 'getValue'), $value));
 }
 /**
  * {@inheritDoc}
  */
 public function setValue($value)
 {
     return parent::setValue($this->getProxy()->getValue($value));
 }
Beispiel #3
0
 public function testOptionValueinSelectedOptions()
 {
     $element = new MultiCheckboxElement();
     $element->setValueOptions(array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'));
     $optionValue = 'option3';
     $selectedOptions = array('option1', 'option3');
     $element->setValue($selectedOptions);
     $this->assertTrue(in_array($optionValue, $element->getValue()));
 }