thd/lib/form/doctrine/base/BaseThdSegmentForm.class.php
changeset 35 94a1dc255022
equal deleted inserted replaced
34:56befcb22751 35:94a1dc255022
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * ThdSegment form base class.
       
     5  *
       
     6  * @package    form
       
     7  * @subpackage thd_segment
       
     8  * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
       
     9  */
       
    10 class BaseThdSegmentForm extends BaseFormDoctrine
       
    11 {
       
    12   public function setup()
       
    13   {
       
    14     $this->setWidgets(array(
       
    15       'id'            => new sfWidgetFormInputHidden(),
       
    16       'title'         => new sfWidgetFormInput(),
       
    17       'video_ref'     => new sfWidgetFormDoctrineChoice(array('model' => 'ThdVideo', 'add_empty' => false)),
       
    18       'start'         => new sfWidgetFormInput(),
       
    19       'end'           => new sfWidgetFormInput(),
       
    20       'user_id'       => new sfWidgetFormInput(),
       
    21       'creation_date' => new sfWidgetFormDateTime(),
       
    22     ));
       
    23 
       
    24     $this->setValidators(array(
       
    25       'id'            => new sfValidatorDoctrineChoice(array('model' => 'ThdSegment', 'column' => 'id', 'required' => false)),
       
    26       'title'         => new sfValidatorString(array('max_length' => 255)),
       
    27       'video_ref'     => new sfValidatorDoctrineChoice(array('model' => 'ThdVideo')),
       
    28       'start'         => new sfValidatorNumber(),
       
    29       'end'           => new sfValidatorNumber(),
       
    30       'user_id'       => new sfValidatorInteger(),
       
    31       'creation_date' => new sfValidatorDateTime(),
       
    32     ));
       
    33 
       
    34     $this->widgetSchema->setNameFormat('thd_segment[%s]');
       
    35 
       
    36     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
       
    37 
       
    38     parent::setup();
       
    39   }
       
    40 
       
    41   public function getModelName()
       
    42   {
       
    43     return 'ThdSegment';
       
    44   }
       
    45 
       
    46 }