<?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(
      'type'    => new sfWidgetFormFilterInput(),
      'file'    => new sfWidgetFormFilterInput(),
      'film_id' => new sfWidgetFormDoctrineChoice(array('model' => 'ThdFilm', 'add_empty' => true)),
    ));

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

    $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',
      'type'    => 'Number',
      'file'    => 'Text',
      'film_id' => 'ForeignKey',
    );
  }
}