thd/lib/form/doctrine/base/BaseThdSegmentForm.class.php
author Matthieu Totet
Tue, 17 Nov 2009 15:55:57 +0100
changeset 36 c04e1f99748a
parent 35 94a1dc255022
permissions -rw-r--r--
Commit de Matthieu

<?php

/**
 * ThdSegment form base class.
 *
 * @package    form
 * @subpackage thd_segment
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseThdSegmentForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'title'         => new sfWidgetFormInput(),
      'video_ref'     => new sfWidgetFormDoctrineChoice(array('model' => 'ThdVideo', 'add_empty' => false)),
      'start'         => new sfWidgetFormInput(),
      'end'           => new sfWidgetFormInput(),
      'user_id'       => new sfWidgetFormInput(),
      'creation_date' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorDoctrineChoice(array('model' => 'ThdSegment', 'column' => 'id', 'required' => false)),
      'title'         => new sfValidatorString(array('max_length' => 255)),
      'video_ref'     => new sfValidatorDoctrineChoice(array('model' => 'ThdVideo')),
      'start'         => new sfValidatorNumber(),
      'end'           => new sfValidatorNumber(),
      'user_id'       => new sfValidatorInteger(),
      'creation_date' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('thd_segment[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'ThdSegment';
  }

}