Phalcon\Forms\Element doesn't have removeValidator()


I have form with one field (Company NIP number) which is uniqe in DB. I woudlike to use one form to add and edit actions but in edit action I need to remove my own Uniqueness validator from "NIP" field. How can I do this? Class Phalcon\Forms\Element has only addValidator and getValidators methods.

edited Jan '15

Ofcourse I can extends \Phalcon\Forms\Element and implement method "removeValidator" ($_validators is protected variable). but also I need to implement render method in each form field class (check, date, email ...)


In the sample below there's one where u can initialize the form with options. you can use to to do some logic checking

edited Jan '15
public function initialize(Users $user, $options = []) {

    $name = new Text('name', array(
            'placeholder' => 'Your name',
            'using' => array('id', 'name'),

    if (empty($options['edit'])) { // !in_array('edit') could work depending ...
        // don't add validator when you create the form and set a certain option
            new PresenceOf(array(
                'message' => 'Your name is required'