Пример #1
0
 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);
 }
Пример #2
0
 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;
 }
Пример #3
0
 public function testIsValid()
 {
     $arrayInputFilter = new InArray('status', [1, 2, 3]);
     $arrayInputFilter->setValue('foo');
     $this->assertFalse($arrayInputFilter->isValid());
 }