-- keith Pope <[email protected]> wrote
(on Monday, 23 March 2009, 03:26 PM +0000):
> I have been trying out Zend_App again as it seems to be moving on a
> bit now, I am having some problems using modules, I keep getting:
> 
> Maximum function nesting level of '100' reached, aborting! in
> /home/keith/www/ZApp/library/Zend/Loader/PluginLoader.php on line 125
> 
> I have been trying to track down whats causing this for a while but
> with no success, it seems to be when the modules bootstrap is called
> it recalls everything???
> 
> Also I was wondering why the modules resource skips the default
> module, how do you say add autoloader paths to the default module?

Typically, the bootstrap you attach to Zend_Application will be the one
from your default module -- which is why we skip it. I need to change
the functionality slightly to get the default module name from the front
controller, but this will be the basic functionality.

If you want to add autoloader paths to the default module, you should
create a bootstrap resource or initializer method for doing so. I have
not done this at this time because, by convention currently, the default
module has no namespace prefix, making it a bit more troublesome to
setup resource autoloading in a way that people will be able to drop in
to existing applications.

As to your questions here... Does the bootstrap in APPLICATION_PATH .
'/bootstrap/Bootstrap.php' contain a class named 'Bootstrap'? or does it
contain the class 'Storefront_Bootstrap' which you reference below? If
the latter, you need to modify how you pass the bootstrap argument to
Zend_Application:

    'bootstrap' => array(
        'path'  => APPLICATION_PATH . '/bootstrap/Bootstrap.php',
        'class' => 'Storefront_Bootstrap',
    ),

As for your other error:

    Maximum function nesting level of '100' reached, aborting! in
    /home/keith/www/ZApp/library/Zend/Loader/PluginLoader.php on line 125

This sounds like you're somehow specifying an object as the prefix to
pass to the plugin loader. I haven't been able to reproduce the issue
locally.

A couple more comments below...

> I am using the structure:
> 
> modules
>    module1
>    module2
> 
> And my app setup:
> 
> <?php
> $paths = array(
>     get_include_path(),
>     '../library/Incu',
>      '../library',
> );
> set_include_path(join(PATH_SEPARATOR, $paths));

Use implode() instead of join(). It's faster.

> defined('APPLICATION_PATH')
>     or define('APPLICATION_PATH', realpath(dirname(__FILE__) .
> '/../application'));
> defined('APPLICATION_ENV')
>     or define('APPLICATION_ENV', 'development');
> 
> require_once 'Zend/Application.php';
> 
> $application = new Zend_Application(APPLICATION_ENV, array(
>     'bootstrap' => APPLICATION_PATH . '/bootstrap/Bootstrap.php',
>     'autoloadernamespaces' => array('Zend', 'SF'),


BTW, you'll want to append the above with '_': array('Zend_', 'SF_').
This is so that the Autoloader can be used with libraries that do not
use a separator in their class names.


>     'resources' => array(
>         'frontcontroller' => array(
>             'moduledirectory' => APPLICATION_PATH . '/modules',
>             'defaultmodule' => 'default',

This latter setting isn't really necessary; that's the default value
anyways.

>         ),
>         'modules' => array(),
>     ),
>     'phpsettings' => array(
>             'display_errors' => true,
>             'error_reporting' => E_ALL|E_STRICT,
>             'date.timezone' =>  'Europe/London',
>         )
>     )
> );
> $application->bootstrap();
> $application->run();
> 
> unset($application);

This unset() call isn't really necessary, either -- nothing else is
happening after this.


> module bootstrap:
> 
> class Storefront_Bootstrap extends Zend_Application_Module_Bootstrap
> {
>     public function _initModule()
>     {
>         $this->getResourceLoader()
>                ->addResourceType(
>                     'modelResource',
>                     'models/resources',
>                     'Resource'
>                );
>          $this->getResourceLoader()
>                ->addResourceType(
>                     'service',
>                     'services',
>                     'Service'
>                );
>     }
> 
>     public function run(){}
> }

-- 
Matthew Weier O'Phinney
Software Architect | [email protected]
Zend Framework     | http://framework.zend.com/

Reply via email to