4

I'm working on a project and have the following project layout:

|Project
    |-Application
        |-api
        |-configs
        |-controllers
        |-models
        |-modules
            |-core
                |-controllers
                |-models
                |-views
                |-Bootstrap.php
            |-site1
            |-site2
            |-site3
        |-views
        |-Bootstrap.php
    |-Docs
    |-Library
    |-Public
    |-.zfproject.xml

I've used this in my application.ini to try and set the default module to be the core module:

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"

resources.frontController.defaultModule = "core"
resources.frontController.defaultControllerName = "Index"
resources.frontController.defaultAction = "index"

resources.modules[] = ""

My problem is that for some reason, I can't get bootstraps working in the modules. It's alsmost as if the default module isn't being changed. The application behaves like it is, until I try and load the bootstraps - I get this error:

Fatal error: Uncaught exception 'Zend_Application_Resource_Exception' with message 'Bootstrap file found for module "default" but bootstrap class "Default_Bootstrap" not found' in M:\Zend_Framework\library\Zend\Application\Resource\Modules.php on line 85

Prefixed by this error:

Zend_Application_Resource_Exception: Bootstrap file found for module "default" but bootstrap class "Default_Bootstrap" not found in M:\Zend_Framework\library\Zend\Application\Resource\Modules.php on line 85

Can anyone see where I'm going wrong?

My Application/Bootstrap.php file:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
}

My Application/Core/Bootstrap.php file:

class Core_Bootstrap extends Zend_Application_Module_Bootstrap 
{   
}

2 Answers 2

6

Not 100% on this but if you remove the following line:

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

that may resolve the issue. If i'm not mistaken, as you're using modules, setting this will cause an error.

Sign up to request clarification or add additional context in comments.

2 Comments

This has indeed fixed it! Doing a print_r of the modules detected in Zend_Application_Resource_Module now returns an array of all my modules EXCLUDING the 'default one'!
WOW! Thanks, thanks, thanks! I was in the second week with this problem in my Unit test, now is resolved!! o/
0

Looks like you might be missing one line from your application.ini:

resources.frontController.params.prefixDefaultModule = ""

Try using it this way and see if it works, I think this just tells the app that when using modules, the module named 'default' has no prefix.
Although I could be wrong so you may have to experiment.
Ok, maybe two lines are missing :)

resources.frontController.moduleControllerDirectoryName = "controllers"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.