<?php

/**
 * Banner form base class.
 *
 * @method Banner getObject() Returns the current form's model object
 *
 * @package    sf
 * @subpackage form
 * @author     Atma
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseBannerForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(array(), array()),
      'file'         => new sfWidgetFormInputText(array(), array("size" => 64, "maxlength" => 255, "required" => true)),
      'is_activated' => new sfWidgetFormInputCheckbox(array(), array("required" => true)),
      'cat_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cat'), 'add_empty' => false), array("required" => true)),
      'created_at'   => new sfWidgetFormDateTime(array(), array("required" => true)),
      'updated_at'   => new sfWidgetFormDateTime(array(), array("required" => true)),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'file'         => new sfValidatorString(array('max_length' => 255)),
      'is_activated' => new sfValidatorBoolean(array('required' => false)),
      'cat_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cat'))),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
    ));

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

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

    $this->setupInheritance();

    parent::setup();
  }

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

}
