Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/**
4
 * Attachment form base class.
5
 *
6
 * @method Attachment getObject() Returns the current form's model object
7
 *
8
 * @package    ##PROJECT_NAME##
9
 * @subpackage form
10
 * @author     Your name here
11
 */
12
abstract class BaseAttachmentForm extends BaseFormPropel
13
{
14
  public function setup()
15
  {
16
    $this->setWidgets(array(
17
      'id'         => new sfWidgetFormInputHidden(),
18
      'article_id' => new sfWidgetFormPropelChoice(array('model' => 'Article', 'add_empty' => true)),
19
      'name'       => new sfWidgetFormInputText(),
20
      'file'       => new sfWidgetFormInputText(),
21
    ));
22
 
23
    $this->setValidators(array(
24
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
25
      'article_id' => new sfValidatorPropelChoice(array('model' => 'Article', 'column' => 'id', 'required' => false)),
26
      'name'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
27
      'file'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
28
    ));
29
 
30
    $this->widgetSchema->setNameFormat('attachment[%s]');
31
 
32
    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
33
 
34
    parent::setup();
35
  }
36
 
37
  public function getModelName()
38
  {
39
    return 'Attachment';
40
  }
41
 
42
 
43
}