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
| abstract class BaseProfilePostForm extends BaseFormDoctrine
{
public function setup()
{
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
'profile_from_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ProfileFrom'), 'add_empty' => false)),
'profile_to_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ProfileTo'), 'add_empty' => false)),
'message' => new sfWidgetFormInputText(),
'date' => new sfWidgetFormInputText(),
'validated' => new sfWidgetFormInputCheckbox(),
));
$this->setValidators(array(
'id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
'profile_from_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ProfileFrom'))),
'profile_to_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ProfileTo'))),
'message' => new sfValidatorString(array('max_length' => 255)),
'date' => new sfValidatorPass(),
'validated' => new sfValidatorBoolean(array('required' => false)),
));
$this->widgetSchema->setNameFormat('profile_post[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
public function getModelName()
{
return 'ProfilePost';
}
} |
Partager