<?php

/**
 * BasketOrder 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 BaseBasketOrderFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'username'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'phone'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'email'            => new sfWidgetFormFilterInput(),
      'delivery_price'   => new sfWidgetFormFilterInput(),
      'delivery_type'    => new sfWidgetFormChoice(array('choices' => array('' => '', 'Самовывоз' => 'Самовывоз', 'Доставка по адресу' => 'Доставка по адресу'))),
      'delivery_address' => new sfWidgetFormFilterInput(),
      'comment'          => new sfWidgetFormFilterInput(),
      'payment_type'     => new sfWidgetFormChoice(array('choices' => array('' => '', 'Наличный' => 'Наличный', 'Безналичный' => 'Безналичный'))),
      'is_confirm'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_confirm_admin' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_payed'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_given'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'username'         => new sfValidatorPass(array('required' => false)),
      'phone'            => new sfValidatorPass(array('required' => false)),
      'email'            => new sfValidatorPass(array('required' => false)),
      'delivery_price'   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'delivery_type'    => new sfValidatorChoice(array('required' => false, 'choices' => array('Самовывоз' => 'Самовывоз', 'Доставка по адресу' => 'Доставка по адресу'))),
      'delivery_address' => new sfValidatorPass(array('required' => false)),
      'comment'          => new sfValidatorPass(array('required' => false)),
      'payment_type'     => new sfValidatorChoice(array('required' => false, 'choices' => array('Наличный' => 'Наличный', 'Безналичный' => 'Безналичный'))),
      'is_confirm'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_confirm_admin' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_payed'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_given'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

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

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

    $this->setupInheritance();

    parent::setup();
  }

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

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'username'         => 'Text',
      'phone'            => 'Text',
      'email'            => 'Text',
      'delivery_price'   => 'Number',
      'delivery_type'    => 'Enum',
      'delivery_address' => 'Text',
      'comment'          => 'Text',
      'payment_type'     => 'Enum',
      'is_confirm'       => 'Boolean',
      'is_confirm_admin' => 'Boolean',
      'is_payed'         => 'Boolean',
      'is_given'         => 'Boolean',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
    );
  }
}
