<?php

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

/**
 * ThdFilm filter form base class.
 *
 * @package    filters
 * @subpackage ThdFilm *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseThdFilmFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'ref'             => new sfWidgetFormDoctrineChoice(array('model' => 'ThdImage', 'add_empty' => true)),
      'title'           => new sfWidgetFormFilterInput(),
      'pitch'           => new sfWidgetFormFilterInput(),
      'duration'        => new sfWidgetFormFilterInput(),
      'directors'       => new sfWidgetFormFilterInput(),
      'actors'          => new sfWidgetFormFilterInput(),
      'slug_url'        => new sfWidgetFormFilterInput(),
      'original_title'  => new sfWidgetFormFilterInput(),
      'production_year' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'ref'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'ThdImage', 'column' => 'id')),
      'title'           => new sfValidatorPass(array('required' => false)),
      'pitch'           => new sfValidatorPass(array('required' => false)),
      'duration'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'directors'       => new sfValidatorPass(array('required' => false)),
      'actors'          => new sfValidatorPass(array('required' => false)),
      'slug_url'        => new sfValidatorPass(array('required' => false)),
      'original_title'  => new sfValidatorPass(array('required' => false)),
      'production_year' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

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

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

    parent::setup();
  }

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

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'ref'             => 'ForeignKey',
      'title'           => 'Text',
      'pitch'           => 'Text',
      'duration'        => 'Number',
      'directors'       => 'Text',
      'actors'          => 'Text',
      'slug_url'        => 'Text',
      'original_title'  => 'Text',
      'production_year' => 'Number',
    );
  }
}