<?php
/**
* News form base class.
*
* @method News getObject() Returns the current form's model object
*
* @package pwp
* @subpackage form
* @author Victor Rad' <victor.v.rad[at]gmail.com>
* @version SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24051 2009-11-16 21:08:08Z Kris.Wallsmith $
*/
abstract class BaseNewsForm extends BaseFormDoctrine
{
public function setup()
{
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
'news_providers_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('NewsProviders'), 'add_empty' => false)),
'description' => new sfWidgetFormTextarea(),
'hash' => new sfWidgetFormInputText(),
'created_at' => new sfWidgetFormDateTime(),
'title' => new sfWidgetFormInputText(),
'link' => new sfWidgetFormTextarea(),
'updated_at' => new sfWidgetFormDateTime(),
));
$this->setValidators(array(
'id' => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
'news_providers_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('NewsProviders'))),
'description' => new sfValidatorString(),
'hash' => new sfValidatorString(array('max_length' => 32)),
'created_at' => new sfValidatorDateTime(),
'title' => new sfValidatorString(array('max_length' => 200, 'required' => false)),
'link' => new sfValidatorString(array('required' => false)),
'updated_at' => new sfValidatorDateTime(array('required' => false)),
));
$this->widgetSchema->setNameFormat('news[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
public function getModelName()
{
return 'News';
}
}