Disable notInArray Validator Zend Framework 2

后端 未结 5 2392
醉梦人生
醉梦人生 2021-02-20 12:36

Is there a way to disable notInArray Validator in Zend Framework 2. All the info on the internet shows how to disable the notInArray Validator in Zend Framework 1, for example i

5条回答
  •  心在旅途
    2021-02-20 12:59

    I had the same problem and what i did is populate the element before validate it, for example:

    $clientForm->get('city')->setValueOptions($options);
    $clientForm->setData($post);
    
    if ($clientForm->isValid()) {
      //
    } else {
      //
    }
    

    This don't disable notInArray valitador but you can trick it.

提交回复
热议问题