Witam smile.gif

Walcze z Zendem od niedawna i mam taki oto problem:

Aplikacja jest modułowa, moduły mam w katalogu:

project/application/modules/

Akurat teraz mam jeden moduł: default a w nim kontrolery: Error, Index, User. Problem w tym, ze kontrolera User w ogóle mi nie widzi, tj. mam błąd 404, tak jakby nie było w ogóle linku. Ogólnie wygląda to tak, że jak wpisuje w przegladarke localhost/projekt/public/index to działa normalnie, jak zamienie index na user to juz nie chce chodzic.

Wszystkie akcje z kontrolera Index działają poprawnie, doctrine działa poprawnie. Plik htaccess standardowy, w katalogu public. smile.gif

bootstrap wygląda u mnie tak:

  1. class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
  2. {
  3. public function _initDoctrine()
  4. {
  5. $doctrineConfig = $this->getOption('doctrine');
  6. $manager = Doctrine_Manager::getInstance();
  7. $manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
  8. $conn = Doctrine_Manager::connection($doctrineConfig['dsn'],'doctrine');
  9. $conn->setAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM, true);
  10. return $conn;
  11. }
  12.  
  13. protected function _initViewHelpers()
  14. {
  15. $this->bootstrap('layout');
  16. $layout = $this->getResource('layout');
  17. $view = $layout->getView();
  18. $view->doctype('HTML4_STRICT');
  19. $view->headMeta()->appendHttpEquiv('Content-type','text/html;charset=utf-8');
  20. $view->headTitle('QuIZ');
  21. }
  22.  
  23. protected function _initAutoLoad()
  24. {
  25. $modelLoader = new Zend_Application_Module_Autoloader(array(
  26. 'namespace' => '',
  27. 'basePath' => APPLICATION_PATH.'/modules/default'
  28. ));
  29. return $modelLoader;
  30. }
  31.  
  32. }


application.ini

  1. [production]
  2. phpSettings.display_startup_errors = 1
  3. phpSettings.display_errors = 1
  4. includePaths.library = APPLICATION_PATH "/../library"
  5. bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
  6. bootstrap.class = "Bootstrap"
  7. appnamespace = "Application"
  8. resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
  9. resources.frontController.params.displayExceptions = 1
  10. resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
  11. resources.modules = ""
  12.  
  13. resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
  14.  
  15. autoloaderNamespaces[] = "My_"
  16. autoloaderNamespaces[] = "Doctrine"
  17.  
  18. doctrine.dsn = "mysql://root:owoc@localhost/quiz"
  19.  
  20. doctrine.data_fixtures_path = APPLICATION_PATH "/../doctrine/data/fixtures"
  21. doctrine.models_path = APPLICATION_PATH "/models"
  22. doctrine.migrations_path = APPLICATION_PATH "/../doctrine/migrations"
  23. doctrine.sql_path = APPLICATION_PATH "/../doctrine/data/sql"
  24. doctrine.yaml_schema_path = APPLICATION_PATH "/../doctrine/schema"
  25.  
  26. doctrine.generate_models_options.pearStyle = true
  27. doctrine.generate_models_options.generateTableClasses = true
  28. doctrine.generate_models_options.generateBaseClasses = true
  29. doctrine.generate_models_options.baseClassPrefix = "Base_"
  30. doctrine.generate_models_options.baseClassesDirectory =
  31. doctrine.generate_models_options.classPrefixFiles = false
  32. doctrine.generate_models_options.classPrefix = "Application_Model_"
  33.  
  34. [staging : production]
  35.  
  36. [testing : production]
  37. phpSettings.display_startup_errors = 1
  38. phpSettings.display_errors = 1
  39.  
  40. [development : production]
  41. phpSettings.display_startup_errors = 1
  42. phpSettings.display_errors = 1
  43. resources.frontController.params.displayExceptions = 1


htaccess:

  1. SetEnv APPLICATION_ENV development
  2.  
  3. RewriteEngine On
  4. RewriteCond %{REQUEST_FILENAME} -s [OR]
  5. RewriteCond %{REQUEST_FILENAME} -l [OR]
  6. RewriteCond %{REQUEST_FILENAME} -d
  7. RewriteRule ^.*$ - [NC,L]
  8. RewriteRule ^.*$ index.php [NC,L]


usercontroller:
  1. class UserController extends Zend_Controller_Action
  2. {
  3. public function init()
  4. {
  5. /* Initialize action controller here */
  6. }
  7.  
  8. public function indexAction()
  9. {
  10. // action body
  11. }
  12. }


Próbowałem z nazwą klasy UserController, np zmienić ją na Default_UserController ale to nic nie dało.

jeszcze do kompletu dodam plik index.php z katalogu /public
index.php
  1. <?php
  2.  
  3. // Define path to application directory
  4. defined('APPLICATION_PATH')
  5. || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
  6.  
  7. // Define application environment
  8. defined('APPLICATION_ENV')
  9. || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
  10.  
  11. // Ensure library/ is on include_path
  12. set_include_path(implode(PATH_SEPARATOR, array(
  13. realpath(APPLICATION_PATH . '/../library'),
  14. )));
  15.  
  16. /** Zend_Application */
  17. require_once 'Zend/Application.php';
  18.  
  19. // Create application, bootstrap, and run
  20. $application = new Zend_Application(
  21. APPLICATION_ENV,
  22. APPLICATION_PATH . '/configs/application.ini'
  23. );
  24.  
  25. $application->bootstrap()
  26. ->run();


Czyli jak widać też standard... Ma ktoś jakiś pomysł?

//EDIT -- problem rozwiązany, miałem wyłączony redirector w apachu...