Actions

Source Code of This Project

/lib/form/doctrine/base/BaseNewsProvidersForm.class.php

<?php

/**
 * NewsProviders form base class.
 *
 * @method NewsProviders 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 BaseNewsProvidersForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'status'      => new sfWidgetFormChoice(array('choices' => array('active' => 'active', 'inactive' => 'inactive'))),
      'name'        => new sfWidgetFormInputText(),
      'title'       => new sfWidgetFormInputText(),
      'description' => new sfWidgetFormTextarea(),
      'link'        => new sfWidgetFormInputText(),
      'news_link'   => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'status'      => new sfValidatorChoice(array('choices' => array('active' => 'active', 'inactive' => 'inactive'), 'required' => false)),
      'name'        => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'title'       => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'description' => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'link'        => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'news_link'   => new sfValidatorString(array('max_length' => 200, 'required' => false)),
    ));

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

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

    $this->setupInheritance();

    parent::setup();
  }

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

}