Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

2 Stron V  < 1 2  
Reply to this topicStart new topic
> [Symfony]setError
Lonas
post
Post #21





Grupa: Zarejestrowani
Postów: 576
Pomógł: 14
Dołączył: 9.11.2005

Ostrzeżenie: (20%)
X----


Walidator działa - wyglada to narazie tak :

  1. <?php
  2. class sfFileImageValidator extends sfValidatorFile
  3. {
  4.  
  5.  protected function configure($options = array(), $messages = array())
  6.  {
  7.    parent::configure($options, $messages);
  8.  
  9.    $this->addOption('max_width');
  10.    $this->addMessage('max_width', 'tttt');
  11.  }
  12.  
  13.  
  14.  protected function doClean($value)
  15.  {
  16.    
  17.    list($width, $height) = getimagesize($value['tmp_name']);
  18.    
  19.  
  20.    if ($this->hasOption('max_width') && $width > $this->getOption('max_width'))
  21.    {
  22.      throw new sfValidatorError($this, 'max_width', array('value' => $value, 'max_width' => $this->getOption('max_width')));
  23.    }
  24.  
  25.    return $value;
  26.  }
  27.  
  28. }
  29. ?>


Jak będzie gotowy wrzuce pełen kod, nie działa mi natatomiast w sytuacji gdy walidacja się powiedzie - walidator nie zwraca obiektu
w sfValidatorFile zwracany jest obiekt

  1. <?php
  2. $class = $this->getOption('validated_file_class');
  3.  
  4.    return new $class($value['name'], $mimeType, $value['tmp_name'], $value['size'], $this->getOption('path'));
  5. ?>


Fatal error: Call to a member function save() on a non-object in C:\Program Files\WebServ\httpd\sf_gallery\lib\symfony\plugins\sfPropelPlugin\lib\form\sfFormPropel.class.php on line 508

jak to powinno być w moim przypadku ?

Ten post edytował Lonas 23.03.2009, 15:16:35
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 15.10.2025 - 21:39