<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * ThdImage filter form base class.
 *
 * @package    filters
 * @subpackage ThdImage *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseThdImageFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'film_ref' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => true)),
      'type'     => new sfWidgetFormFilterInput(),
      'file'     => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'film_ref' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdFilm', 'column' => 'id')),
      'type'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'file'     => new sfValidatorPass(array('required' => false)),
    ));

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

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

    parent::setup();
  }

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

  public function getFields()
  {
    return array(
      'id'       => 'Number',
      'film_ref' => 'ForeignKey',
      'type'     => 'Number',
      'file'     => 'Text',
    );
  }
}