<?php

/**
 * Keyword filter form base class.
 *
 * @package    sf
 * @subpackage filter
 * @author     Atma
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseKeywordFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'word' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'rank' => new sfWidgetFormFilterInput(),
      'ids'  => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'word' => new sfValidatorPass(array('required' => false)),
      'rank' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ids'  => new sfValidatorPass(array('required' => false)),
    ));

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

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

    $this->setupInheritance();

    parent::setup();
  }

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

  public function getFields()
  {
    return array(
      'id'   => 'Number',
      'word' => 'Text',
      'rank' => 'Number',
      'ids'  => 'Text',
    );
  }
}
