BaseCatProductForm.class.php 1.11 KB
Newer Older
Яков's avatar
first  
Яков committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

/**
 * CatProduct form base class.
 *
 * @method CatProduct 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 BaseCatProductForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cat_id'     => new sfWidgetFormInputHidden(array(), array()),
      'product_id' => new sfWidgetFormInputHidden(array(), array()),
    ));

    $this->setValidators(array(
      'cat_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'cat_id', 'required' => false)),
      'product_id' => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'product_id', 'required' => false)),
    ));

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

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

    $this->setupInheritance();

    parent::setup();
  }

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

}