<?php

/**
 * BasketOrder form base class.
 *
 * @method BasketOrder 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 BaseBasketOrderForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(array(), array()),
      'username'         => new sfWidgetFormInputText(array(), array("size" => 64, "maxlength" => 255, "required" => true)),
      'phone'            => new sfWidgetFormInputText(array(), array("size" => 24, "maxlength" => 24, "required" => true)),
      'email'            => new sfWidgetFormInputText(array(), array("size" => 64, "maxlength" => 64)),
      'delivery_price'   => new sfWidgetFormInputText(array(), array("size" => 18, "maxlength" => 18)),
      'delivery_type'    => new sfWidgetFormChoice(array('choices' => array('Самовывоз' => 'Самовывоз', 'Доставка по адресу' => 'Доставка по адресу')), array("required" => true)),
      'delivery_address' => new sfWidgetFormInputText(array(), array("size" => 64, "maxlength" => 255)),
      'comment'          => new sfWidgetFormTextarea(array(), array("rows" => 5, "cols" => 70)),
      'payment_type'     => new sfWidgetFormChoice(array('choices' => array('Наличный' => 'Наличный', 'Безналичный' => 'Безналичный')), array("required" => true)),
      'is_confirm'       => new sfWidgetFormInputCheckbox(array(), array("required" => true)),
      'is_confirm_admin' => new sfWidgetFormInputCheckbox(array(), array("required" => true)),
      'is_payed'         => new sfWidgetFormInputCheckbox(array(), array("required" => true)),
      'is_given'         => new sfWidgetFormInputCheckbox(array(), 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)),
      'username'         => new sfValidatorString(array('max_length' => 255)),
      'phone'            => new sfValidatorString(array('max_length' => 24)),
      'email'            => new sfValidatorString(array('max_length' => 64, 'required' => false)),
      'delivery_price'   => new sfValidatorNumber(array('required' => false)),
      'delivery_type'    => new sfValidatorChoice(array('choices' => array(0 => 'Самовывоз', 1 => 'Доставка по адресу'), 'required' => false)),
      'delivery_address' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'comment'          => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'payment_type'     => new sfValidatorChoice(array('choices' => array(0 => 'Наличный', 1 => 'Безналичный'), 'required' => false)),
      'is_confirm'       => new sfValidatorBoolean(array('required' => false)),
      'is_confirm_admin' => new sfValidatorBoolean(array('required' => false)),
      'is_payed'         => new sfValidatorBoolean(array('required' => false)),
      'is_given'         => new sfValidatorBoolean(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

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

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

    $this->setupInheritance();

    parent::setup();
  }

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

}
