public function __construct($finder) { $this->finder = $finder; // key $key = new Text('key', 1, 500); $key->setRequired(false); $this->add($key); // langId $langId = new InArray('langId', $this->getLanguages()->getValuesByAttribute('id')); $langId->setRequired(false); $this->add($langId); }
public function isValid() { $values = $this->value; if (!$values) { return false; } foreach ($values as $value) { $this->value = $value; if (!parent::isValid()) { $this->value = null; return false; } } $this->value = $values; return true; }
public function testIsValid() { $arrayInputFilter = new InArray('status', [1, 2, 3]); $arrayInputFilter->setValue('foo'); $this->assertFalse($arrayInputFilter->isValid()); }