Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework]Zend_Form - nie znajduje klasy
x2008x
post
Post #1





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 10.11.2009

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


Witam, mam problem z formularzami w ZF2. Jako, że dopiero zaczynam, nie wiem gdzie znajduje się błąd.
Strukturę katalogów mam domyślną.

Oto model:
  1. <?php
  2. namespace Example;
  3.  
  4. use Zend\Mvc\ModuleRouteListener;
  5.  
  6.  
  7. class Module
  8. {
  9. public function getConfig()
  10. {
  11. return include __DIR__ . '/config/module.config.php';
  12. }
  13.  
  14. public function getAutoloaderConfig()
  15. {
  16. return array(
  17. 'Zend\Loader\StandardAutoloader' => array(
  18. 'namespaces' => array(
  19. __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
  20. ),
  21. ),
  22. );
  23. }
  24.  
  25.  
  26. }




Tutaj controller:
  1. <?php
  2. namespace Example\Controller;
  3.  
  4. use Zend\Mvc\Controller\AbstractActionController;
  5. use Zend\View\Model\ViewModel;
  6. use Zend\Form\Form;
  7. use Zend\Form\Fieldset;
  8. class IndexController extends AbstractActionController
  9. {
  10. public function indexAction()
  11. {
  12.  
  13.  
  14.  
  15. require_once 'form_add.php';
  16.  
  17. $form = new forms_Formularz();
  18. $this->view->form = $form;
  19.  
  20. return new ViewModel();
  21. }
  22. }



A tutaj sam formularz:
  1. <?php
  2. namespace Example\Form;
  3.  
  4. use Zend\Form\Form;
  5.  
  6. class forms_Formularz extends Zend_Form
  7. {
  8. public function init()
  9. {
  10. $firstname = new Zend_Form_Element_Text('firstname');
  11. $lastname = new Zend_Form_Element_Text('lastname');
  12. $position = new Zend_Form_Element_Select('position');
  13. $description = new Zend_Form_Element_Textarea('description');
  14. $submit = new Zend_Form_Element_Submit('btn-submit');
  15.  
  16. $this->addElement($firstname);
  17. $this->addElement($lastname);
  18. $this->addElement($position);
  19. $this->addElement($description);
  20. $this->addElement($submit);
  21. }
  22. }
  23.  
  24.  
  25. ?>


Błąd brzmi:
  1. Fatal error: Class 'Zend_Form' not found in E:\www\zf\module\Example\src\Example\Controller\form_add.php on line 3


Proszę o pomoc, z góry dzięki.
Widok myślę, że jest zbędny.
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: 14.10.2025 - 08:45