<?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 sfWidgetFormFilterInput(),
      'title'                => new sfWidgetFormFilterInput(),
      'pitch'                => new sfWidgetFormFilterInput(),
      'duration'             => new sfWidgetFormFilterInput(),
      'directors'            => new sfWidgetFormFilterInput(),
      'actors'               => new sfWidgetFormFilterInput(),
      'slug_url'             => new sfWidgetFormFilterInput(),
      'original_title'       => new sfWidgetFormFilterInput(),
      'production_countries' => new sfWidgetFormFilterInput(),
      'production_year'      => new sfWidgetFormFilterInput(),
      'uniqueid'             => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'ref'                  => new sfValidatorPass(array('required' => false)),
      '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_countries' => new sfValidatorPass(array('required' => false)),
      'production_year'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'uniqueid'             => new sfValidatorPass(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'                  => 'Text',
      'title'                => 'Text',
      'pitch'                => 'Text',
      'duration'             => 'Number',
      'directors'            => 'Text',
      'actors'               => 'Text',
      'slug_url'             => 'Text',
      'original_title'       => 'Text',
      'production_countries' => 'Text',
      'production_year'      => 'Number',
      'uniqueid'             => 'Text',
    );
  }
}