Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony]Admin Generator
dtrevo
post
Post #1





Grupa: Zarejestrowani
Postów: 32
Pomógł: 0
Dołączył: 5.12.2008

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


Zainstalowałem Panel Admina, jak chce dodać, albo zedytowac jakieś dane wyskakuje taki błąd:



Fatal error: Class UzytkownikForm contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (sfFormPropel::getModelName) in /var/www/probaa/lib/form/UzytkownikForm.class.php on line 12



Oto plik UzytkownikForm.class.php:

  1. <?php
  2.  
  3. /**
  4.  * Uzytkownik form.
  5.  *
  6.  * @package    nowy
  7.  * @subpackage form
  8.  * @author     Your name here
  9.  * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
  10.  */
  11.  
  12. class UzytkownikForm extends BaseFormPropel
  13. {
  14.  public function configure()
  15.  {
  16.      $this->setWidgets(array(
  17.           'login'=> new sfWidgetFormInput(),
  18.           'haslo'=> new sfWidgetFormInputPassword(),
  19.           'powtorz'=> new sfWidgetFormInputPassword(),
  20.           'mail'=> new sfWidgetFormInput(),
  21.           ));
  22.  
  23.  
  24.       $this->setValidators(array(
  25.        'login'    => new sfValidatorString(array('required' => true), array('required' => 'Musisz wypełnić te pole!')),
  26.        'haslo' => new sfValidatorString(array('required' => true , 'min_length' => 6), array('required' => 'Te Pole jest obowiązkowe', 'min_length' => 'Dla twojego bezpieczeństwa, hasło powinno miec przynajmniej 6 znaków.')),
  27.        'powtorz' => new sfValidatorString(array('required' => true , 'min_length' => 6), array('required' => 'Te Pole jest obowiązkowe')),
  28.        'mail'   => new sfValidatorEmail(array(), array('invalid' => 'The email address is invalid.', 'required' => 'To pole jest obowiązkowe.'))));
  29. $this->validatorSchema->setPostValidator(new sfValidatorAnd(
  30.           array(
  31.        new sfValidatorPropelUnique(array('model' => 'Uzytkownik', 'column' => 'login'), array('invalid' => 'Taki login juz istnieje')),
  32.        new sfValidatorSchemaCompare('powtorz', '==', 'haslo', array(), array('invalid' => 'Different passwords'))
  33.   )));
  34.  
  35.  
  36.   }
  37.  
  38. }
  39. ?>


Ten post edytował dtrevo 13.06.2009, 12:55:36
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dtrevo
post
Post #2





Grupa: Zarejestrowani
Postów: 32
Pomógł: 0
Dołączył: 5.12.2008

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


No kombinuje, kombinuje i nic, ale gdy zmiene żeby klasa UzytkownikForm dziedziczyła z sfForm, to formularz sie wyświetla, podczas gdy dziewdziczy z BaseFormPropel to sie nie wyświetla i wyrzuca to co wyżej. tutaj podaje kontroler:

  1. <?php
  2.  
  3. /**
  4.  * rejestracja actions.
  5.  *
  6.  * @package    probaa
  7.  * @subpackage rejestracja
  8.  * @author     Your name here
  9.  * @version    SVN: $Id: actions.class.php 12479 2008-10-31 10:54:40Z fabien $
  10.  */
  11. class rejestracjaActions extends sfActions
  12. {
  13. /**
  14.   * Executes index action
  15.   *
  16.   * @param sfRequest $request A request object
  17.   */
  18.     public function executeIndex($request)
  19.  {
  20. $this->form = new UzytkownikForm();
  21.    $this->komunikat = ' ';
  22.  
  23.    if ($request->isMethod('post'))
  24.    {
  25.      $this->form->bind(array(
  26. 'login' => $request->getParameter('login'),
  27. 'haslo' => $request->getParameter('haslo'),
  28. 'powtorz' => $request->getParameter('powtorz'),
  29. 'mail' => $request->getParameter('mail')));
  30.      if ($this->form->isValid())
  31.      {
  32.        try{
  33.             $u = new Uzytkownik();
  34.             $u->setLogin($request->getParameter('login'));
  35.             $u->setHaslo($request->getParameter('haslo'));
  36.             $u->setMail($request->getParameter('mail'));
  37.             $u->save();
  38.             return $this->forward('rejestracja', 'dziekujemy');
  39.        }
  40.  
  41.       catch(Ecxeption $e){
  42.           return $this->forward('rejestracja', 'blad');
  43.       }
  44.  
  45.      }
  46.  
  47.    }
  48.  }
  49.  public function executeDziekujemy(){
  50.      $this->komunikat = 'dziekujemy za rejstracje, przebiegła pomyślnie.';
  51.      $this->setTemplate('index');
  52.  
  53.  }
  54.  public function executeBlad(){
  55.      $this->komunikat = 'Wystapił błąd w czasie przetwarzanie informacji.';
  56.      $this->setTemplate('index');
  57.  }
  58.  
  59. }
  60. ?>


Ten post edytował dtrevo 13.06.2009, 12:55:03
Go to the top of the page
+Quote Post

Posty w temacie


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: 10.10.2025 - 23:52