-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When creating your bootstrap file, the methods are actually executed in
the order they appear in the class. The same goes for the resources;
they are executed in the order they are added (FIFO).
...................................
:  ___   _   ___ ___ ___ _ ___    :
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:........:........................:
: Web    : http://www.dasprids.de :
: E-mail : m...@dasprids.de       :
: Jabber : jab...@dasprids.de     :
: ICQ    : 105677955              :
:........:........................:


keith Pope schrieb:
> Hi Matthew,
> 
> Your suggestions worked I have it working nicely now :)
> 
> I would maybe suggest making this clear when the documentation is
> written, it was a little counter intuitive that the default module is
> handled differently to other modules.
> 
> Also I still have some reservations about the control we have over the
> order in with bootstrap methods and resources are executed, its seems
> that you could end up using a lot of $this->bootstrap(''); calls
> within your bootstrap class/ resource classes. It may be a nice idea
> to also have a stack you could add to as well as standard way, so you
> can manage order in one place.
> 
> One other thing to to get everything working I added this to my bootstrap 
> class:
> 
> class Bootstrap extends Zend_Application_Bootstrap_Base
> ....
>     protected function _initDefaultAutoloader()
>     {
>         if (null === $this->_resourceLoader) {
>             $this->_resourceLoader = new
> Zend_Application_Module_Autoloader(array(
>                 'namespace' => 'Storefront',
>                 'basePath'  => APPLICATION_PATH . '/modules/storefront',
>             ));
>             $this->_resourceLoader
>                ->addResourceType(
>                     'modelResource',
>                     'models/resources',
>                     'Resource'
>                );
>              $this->_resourceLoader
>                    ->addResourceType(
>                         'service',
>                         'services',
>                         'Service'
>                    );
>         }
>         return $this->_resourceLoader;
>     }
> 
> Is there a better way of doing this, I see that the
> Zend_Application_Module_Bootstrap already has the resource loader
> functionality, would it work if I extend from that instead of
> Zend_Application_Bootstrap_Base?
> 
> Thx again, hope the feedback is of some use.
> 
> Keith
> 
> 2009/3/23 keith Pope <mute.p...@googlemail.com>:
>> Thx for the tips Matthew :)
>>
>> I think my examples were a little confusing, I have been hacking about
>> all day trying to figure out my looping problem :)
>>
>> For my storefront app I use one module currently storefront which I
>> set as the default module, this was so I can have everything
>> namespaced nicely. I will try adding the resource autoloaders in the
>> bootstrap and see how that goes, though I did get the same loop error
>> when using more than one module.
>>
>> I will report back if I continue to have problems :) I know the
>> component is still being worked on, just trying to get my head around
>> the process so I can add it to the book chapters I am currently
>> working on.
>>
>> Thanks again for the help
>>
>>
>> 2009/3/23 Matthew Weier O'Phinney <matt...@zend.com>:
>>> -- keith Pope <mute.p...@googlemail.com> 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 | matt...@zend.com
>>> Zend Framework     | http://framework.zend.com/
>>>
>>
>>
>> --
>> ----------------------------------------------------------------------
>> [MuTe]
>> ----------------------------------------------------------------------
>>
> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknIwBEACgkQ0HfT5Ws789B7wgCgkPeXZlEf4zHU2LEVio/VwdS0
4cEAoNDMhKa5J7yJyArLXeTmlZpbEK77
=xRUD
-----END PGP SIGNATURE-----

Reply via email to