Ok, 
I reply to myself, models classes must be called like Model_{modelName}.
Hope this helps 

Sergio Rinaudo



From: [email protected]
To: [email protected]; [email protected]
Date: Thu, 7 May 2009 14:08:30 +0200
Subject: RE: [fw-general] How to automatically  load  resources








Hi, 
thanks for reply.
I tried it but I get always the same error.

Just to let you know, my project is created using Zend_Tool and I've implemeted 
to it just the module management via application.ini.
However, my 'default' module isn't inside the module directory, so this is my 
application tree:

application
-modules
--admin
---controllers
---models
---views
-controllers
-models
-views
-layouts

I also tried on my bootstrap's _initAutoloader method to use both 'Default' and 
'' (empty) namespaces, I still get the same error.

I need to use a model class in my bootstrap to ( try to ) setup Lucene, calling 
an observer class located in 'models', I also used to call 
$this->bootstrap('autoloader'); like you adviced.

Where I do mistake?
Thanks

Sergio Rinaudo




> Date: Thu, 7 May 2009 07:49:44 -0400
> From: [email protected]
> To: [email protected]
> Subject: Re: [fw-general] How to automatically  load  resources
> 
> -- Sergio Rinaudo <[email protected]> wrote
> (on Thursday, 07 May 2009, 01:15 PM +0200):
> > I need to load from bootstrap some resources located in my 'models' 
> > directory.
> > But if I try I get
> > 
> > Fatal error: Class '{model}' not found in [....]\application\Bootstrap.php 
> > on
> > line 201
> > 
> > What to do to include resources located in models dir?
> > 
> > I notice there is a class Zend_Application_Module_Autoloader ( maybe ) for 
> > this
> > purpose, I tried to use it without success
> 
> I'd create a resource method in your bootstrap that defines the resource
> autoloader:
> 
>     class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
>     {
>         protected function _initAutoloader()
>         {
>             $loader = new Zend_Application_Module_Autoloader(array(
>                 'namespace' => 'Default',
>                 'basePath'  => APPLICATION_PATH,
>             ));
>         }
>     }
> 
> The above sets up autoloading for the default module, with a namespace
> of 'Default'. Models will then need a class prefix of 'Default_Model_'.
> 
> Then, in methods where you need to load from models, add the above
> method as a dependency:
> 
>     $this->bootstrap('autoloader');
> 
> -- 
> Matthew Weier O'Phinney
> Project Lead            | [email protected]
> Zend Framework          | http://framework.zend.com/

Quali sono le parole più cliccate? Scopri la top!
_________________________________________________________________
Più di 100 Emoticon gratis per il tuo Messenger!
http://intrattenimento.it.msn.com/emoticon

Reply via email to