public function setup()
 {
     parent::setup();
     $this->widgetSchema['batchsize'] = new sfWidgetFormInput(array(), array('class' => 'text'));
     $this->setValidator('batchsize', new sfValidatorInteger(array('min' => 1, 'max' => sfConfig::get('app_rt_voucher_batch_max', 10000), 'required' => true), array('required' => 'Please provide a batch size', 'min' => 'Minimum batch size is 1', 'max' => 'Maximum batch size is ' . sfConfig::get('app_rt_voucher_batch_max', 10000))));
     $this->setDefault('batchsize', 1);
     $this->widgetSchema->setLabel('batchsize', "Batch size");
     $this->widgetSchema->setHelp('batchsize', 'The total number of unique vouchers to be created.');
     $this->setDefault('mode', 'Single');
 }
 public function setup()
 {
     parent::setup();
     unset($this['type'], $this['batch_reference'], $this['created_at'], $this['updated_at']);
     $this->setWidget('code', new sfWidgetFormInputText());
     $this->setWidget('mode', new sfWidgetFormChoice(array('choices' => array('Single' => 'Single user voucher', 'Group' => 'Group / multi-user voucher'))));
     $this->validatorSchema['code'] = new sfValidatorAnd(array(new sfValidatorString(array('min_length' => 1, 'max_length' => 12, 'required' => true), array('required' => 'Please provide a valid voucher code.')), new rtShopVoucherCodeValidator(array('required' => true), array('required' => 'Please provide a valid voucher code.'))));
     $this->validatorSchema->setPostValidator(new sfValidatorDoctrineUnique(array('model' => 'rtShopVoucher', 'column' => array('code')), array('invalid' => 'Voucher code already used.')));
     $this->widgetSchema->setLabel('code', "Voucher Code");
     $this->widgetSchema->setHelp('count', 'How many times can this voucher be used. The "count" will automtically reduce per usage.');
 }