2009年4月9日星期四

Re: [fw-mvc] Autoloading module resources with 1.8 Preview

2009/4/9 Cristian Bichis <contact@zftutorials.com>:
> Pffff...
>
> Kinda weird to move all app configs and bootstrap under a specific module...
>
> I can't see a good reason for this design... Especially on multi-modules
> apps this looks quite weird...

Not too sure if this is what Matthew meant yet :) I am just
experimenting with different ways at the moment, also I dont really
see the problem with moving the bootstrap file, after all this is the
default module, and you could assume that this module deals with the
majority of the settings. Plus I dont have to manually configure the
default autoloader now, I only need to add to them.

Also the app will never work without a default module.

With what you were trying before, I would double check your paths,
also if you need to see whats registered etc get the autoloader using:

$loader = Zend_Loader_Autoloader::getInstance();
var_dump($loader);

This will should you the entire autoloader config :)

Thx

Keith

>
> --
> Best regards,
> Cristian Bichis
> www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com
>
> I have just updated my code after Matthews earlier comments. So now I have:
>
> modules
> storefront
> Bootstrap.php <- Main bootstrap subclasses
> Zend_Application_Module_Bootstrap
>
> and a config like:
>
> bootstrap.path = APPLICATION_PATH"/modules/storefront/Bootstrap.php"
> bootstrap.class = "Storefront_Bootstrap"
>
> storefront.resources.frontcontroller.moduledirectory =
> APPLICATION_PATH"/modules"
> storefront.resources.frontcontroller.defaultmodule = "storefront"
> storefront.resources.frontcontroller.throwexceptions = false
> storefront.resources.frontcontroller.params.prefixDefaultModule = true
> storefront.resources.frontcontroller.plugins.action = "SF_Plugin_Action"
> storefront.resources.frontcontroller.plugins.admin =
> "SF_Plugin_AdminContext"
>
> By doing it this way Zend_Application will auto register the
> autoloaders for you :)
>
> code is here http://code.google.com/p/zendframeworkstorefront/
>
> Matthew, is this what you meant?
>
> Thx
>
> Keith
>
>
> 2009/4/9 Cristian Bichis <contact@zftutorials.com>:
>
>
> See my answer below...
>
> keith Pope wrote:
>
> 2009/4/9 Matthew Weier O'Phinney <matthew@zend.com>:
>
>
> -- keith Pope <mute.pop3@googlemail.com> wrote
> (on Wednesday, 08 April 2009, 10:17 PM +0100):
>
>
> The module resource skips the default module, you need to set that one
> up yourself, I think :)
>
>
> Your default module should be the one whose bootstrap you are attaching
> to Zend_Application typically.
>
>
> Indeed that makes more sense :) I look forward to your example
> hopefully I have got it mostly correct :)
>
>
> MyAutoloader is:
>
>    //set Autoloader
>     protected function _initAutoloader()
>     {
>         $this->_logger->info('Bootstrap ' . __METHOD__);
>
>         $this->bootstrap('frontcontroller');
>         $this->bootstrap('logging');
>
>         $this->_modules = array('admin' => MODULE_PATH . '/admin', 'default'
> => MODULE_PATH . '/default');
>
>         foreach ($this->_modules as $namespace => $path) {
>             $loader = new Zend_Application_Module_Autoloader(array(
>                 'namespace' => $namespace,
>                 'basePath'  => $path,
>             ));
>         }
>
>         return $this;
>     }
> But i still got that error...
>
> Fatal error: Class 'Admin_Model_Acl' not found in
> D:\_Work\yda\application\Bootstrap.php on line 163
>
> If i change this line
>
>         $this->_modules = array('Admin' => MODULE_PATH . '/admin', 'Default'
> => MODULE_PATH . '/default');
>
> I got this...
>
> Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No
> default module defined for this application'
>
> Confusing...
>
> --
> Best regards,
> Cristian Bichis
> www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com
>
>
>
>

--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------

没有评论: