Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony] bind formularza - $taintedFiles ?
karolski
post 24.08.2010, 09:21:54
Post #1





Grupa: Zarejestrowani
Postów: 199
Pomógł: 0
Dołączył: 12.02.2004
Skąd: Czymiasto

Ostrzeżenie: (0%)
-----


Mam problem z osadzonym formularzem, oto klasa formularza:
  1. class BackendEmbedImageForm extends ImageForm
  2. {
  3. public function configure()
  4. {
  5.  
  6. unset($this['product_id'], $this['ord'], $this['name']);
  7.  
  8. $this->widgetSchema['image'] = new sfWidgetFormInputFileEditable(array(
  9. 'file_src' => sfConfig::get('sf_upload_dir') . '/foto/m' .
  10. $this->getObject()->getImage(),
  11. 'is_image' => true,
  12. 'edit_mode' => !$this->isNew(),
  13. 'template' => '%file% %input%',
  14. 'label' => 'Zdjęcie:'
  15. ));
  16.  
  17. $this->validatorSchema['image'] = new sfValidatorFile(array(
  18. 'path' => sfConfig::get('sf_upload_dir') . '/foto/',
  19. 'required' => false,
  20. 'mime_types' => 'web_images'
  21. ));
  22.  
  23. }
  24. }

W klasie formualrza modelu, konfiguracja formualrza:
  1. $imageForm = new BackendEmbedImageForm();
  2. $this->embedForm('image1', $imageForm);
  3. $this->widgetSchema['image1']->setLabel('Dodaj zdjęcie #1');


teraz w funkcji bind chce sprawdzic czy plik zostal wybrany:

  1. public function bind(array $taintedValues = null, array $taintedFiles = null)
  2. {
  3.  
  4.  
  5. if (WARUNEK)
  6. {
  7. $this->embeddedForms['image1']->getObject()->setProduct($this->getObject());
  8. } else {
  9. unset($this->embeddedForms['image1'], $taintedValues['image1']);
  10. $this->validatorSchema['image1'] = new sfValidatorPass();
  11. }
  12.  
  13. ...

probowalem sprawdzac w nastpeujacy sposob $taintedFiles[image1][image] i czy ta zmienna jest pusta, ale nie dziala, jakis pomysl?


--------------------
Pozdrawiam Karolski
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 28.06.2025 - 04:50