<?php

class wpValidatorSolVioletteSubscribe extends sfValidatorBase {
    public function configure($options = array(), $messages = array()) {
        $this->setMessage('invalid', 'Veuillez sélectionner votre moyen de paiement');
    }

    protected function doClean($values) {
        if ('' == $values['user_payment_mode'] && ('todo' == $values['user_adhesion'] || !empty($values['user_amount']))) {
            throw new sfValidatorErrorSchema($this, array('user_payment_mode' => new sfValidatorError($this, 'invalid')));
        }

        return $values;
    }
}