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
| public function setup()
{
$this->setWidgets(array(
'idphoto' => new sfWidgetFormInputHidden(),
'nomfichier' => new sfWidgetFormInputFileEditable(array('file_src'=>$this->getObject()->getPhotoFileSrc(),'is_image'=>true, 'with_delete'=>!is_null($this->getObject()->getPhotoFileSrc()))),
'fkphotoExpo' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Exposition'), 'add_empty' => false)),
'titrefichier' => new sfWidgetFormInputText(),
'dateupload' => new sfWidgetFormDateTime(array('with_time'=>false)),
'ordre' => new sfWidgetFormInputText(),
));
$this->setValidators(array(
'idphoto' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idphoto')), 'empty_value' => $this->getObject()->get('idphoto'), 'required' => false)),
'nomfichier' => new sfValidatorFile(array('required' => false, 'mime_types'=>'web_images','path'=>$this->getObject()->getPhotoDirPath())),
'fkphotoExpo' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Exposition'))),
'titrefichier' => new sfValidatorString(array('max_length' => 128)),
'dateupload' => new sfValidatorDateTime(array('required'=>false)),
'ordre' => new sfValidatorInteger(),
));
$this->widgetSchema->setLabel('fkphotoExpo','exposition');
$this->widgetSchema->setNameFormat('photo[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->validatorSchema['photo_delete']= new sfValidatorPass();
$this->setupInheritance();
parent::setup();
} |
Partager