thd/lib/form/doctrine/base/BaseThdImageForm.class.php
author Gautier Thibault <gthibault@universcine.com>
Tue, 22 Sep 2009 16:40:38 +0200
changeset 35 94a1dc255022
permissions -rw-r--r--
Commit the all thd project created with the framework symfony

<?php

/**
 * ThdImage form base class.
 *
 * @package    form
 * @subpackage thd_image
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseThdImageForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'       => new sfWidgetFormInputHidden(),
      'film_ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => false)),
      'type'     => new sfWidgetFormInput(),
      'file'     => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'       => new sfValidatorDoctrineChoice(array('model' => 'ThdImage', 'column' => 'id', 'required' => false)),
      'film_ref' => new sfValidatorDoctrineChoice(array('model' => 'ThdFilm')),
      'type'     => new sfValidatorInteger(),
      'file'     => new sfValidatorString(array('max_length' => 255)),
    ));

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

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

    parent::setup();
  }

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

}