28742

Zend Module Bootstrap does not load

Question:

I have a very strange case where my Module is working but my Module's boostrap is not being loaded.

Here is the segment in my application.ini for module autoloading:

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.modules[] = ""

Here is the bootstrapper:

protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'User_', 'basePath' => APPLICATION_PATH .'/modules/user', 'resourceTypes' => array ( 'model' => array( 'path' => 'models', 'namespace' => 'Model', ) ) )); }

Structure of my modules

Application --modules ----user ------config/ ------controllers/ ------models/ ------views/ ------Bootstrap.php ----admin

The problem here is that User_Bootstrap is not being loaded.

<?php class User_Bootstrap extends Zend_Application_Module_Bootstrap { protected function _initAutoload() { Zend_Registry::set('debug', 'haha'); } }

By doing a Zend_Registry::get('debug') on any controller, it doesn't recognize that the key was set in the module bootstrap. In fact any syntax error in the User_Bootstrap does not work.

I don't know why User_Bootstrap is not being autoloaded. This is driving me crazy because I've been researching for 5 hours and can't even get a blog post close to covering this case...

Speaking of which, my models and controller classes are being autoloaded fine.

Answer1:

Try the following...

<ol><li>

Change your application.ini file to use

; lose the quotes resources.modules[] =

See <a href="http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.modules" rel="nofollow">http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.modules</a>

</li> <li>

Remove the _initAutoload() method from your Application Bootstrap class. You don't need this as the module bootstrap will automatically create a resource loader for your User_ classes

</li> </ol>

Answer2:

Not sure but it might as simple as improper case. --Modules is in your structure but you keep referring to it as /modules. These should match case.<br />

I hope it's that simple.

Don't duplicate the function names of your main bootstrap in your module bootstrap, as far as I know in ZF 1.x all of the boostraps get processed every call and I think your _initAutoload in the main boostrap is overriding the module bootstrap.<br />

try calling your function some different like _initModuleAutoload. <br /> At least worth a shot :)

Answer3:

Have you tried disabling frontController directory in application.ini config file? Try commenting/deleting this line:

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

Recommend

  • How to find gaps of data and insert NULL data points instead having gap
  • Tkinter's widget.configure inside a while loop
  • Associating notes with different entities in a database
  • Change message body before sending in outlook 365
  • Test fails, how to find out why?
  • How to restrict user to be logged only one time per session?
  • Xcode App doesn't release memory
  • Embedding most recent YouTube video with Channel ID
  • Check if PCollection is empty - Apache Beam
  • parser m3u file using java in android studio
  • Disable Touch on Materialize Carousel
  • Split string and numbers
  • Grails stops at “Configuring classpath” even at a helloworld project
  • How do I get the Last Insert Id from a JayData transaction?
  • How to get list of all user CA certificates installed in an Android Device?
  • Synchronize two vobs on two different hosts
  • jquery: Disable/Enable button not working after reset
  • overriding equals and hashcode methods in java?
  • GitLab runner on Windows and dealing with & %ERRORLEVEL%
  • what is a good structure to save this data
  • Planned Contrasts on glmmTMB
  • Passing HTTP Post from AWS API GW to Lambda
  • Is there a .NET method equivalent to NETWORKDAYS in Excel?
  • How do I set the logging properties in a spring java configuration?
  • How to load dynamic images in custom ListView
  • Copy and paste data from multiple workbooks to a worksheet in another Workbook
  • Compiling multiple source files in Rcpp
  • Generate and export point cloud from Project Tango
  • What is the difference between dynamically creating a script tag and statically embed a script tag?
  • Ember.js + JQuery-UI Tooltip - Tooltip does not reflect the model / controller changes
  • Create an average of multiple excel chart without the data source
  • concise way of flattening multiindex columns
  • How to split wav file into two or more parts using c#
  • JQuery: Infinite input select
  • 'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs
  • how do i compare two rows and store the similarities of the two rows in another column
  • Can a PHP script be scheduled to run at a specific time or after a specific amount of time has expir
  • How to handle div that is created dynamically in a table
  • How to mutate multiple variables without repeating codes?