2010年12月8日星期三

Re: [fw-mvc] Application autoloading

I thought both are about autoloading.
And sorry, but it's still not clear what "appnamespace" is for.
Lets imaging I've created project with Zend_Tool.
And then changed config to "appnamespace = "Zoo"" instead of
"appnamespace = "Application"".
What should I do now for the project to work like if it still was
"appnamespace = "Application""?

On Wed, Dec 8, 2010 at 5:37 PM, Matthew Weier O'Phinney
<matthew@zend.com> wrote:
> -- K.L. <coviex@gmail.com> wrote
> (on Wednesday, 08 December 2010, 05:03 PM +0200):
>> I instantiate Zend_Application with this part of config:
>>
>> autoloaderNamespaces[] = "Application"
>> autoloaderNamespaces[] = "Other"
>> appnamespace               = "Application"
>>
>> Question is why should I write "autoloaderNamespaces[] =
>> "Application"" if then I have this "appnamespace = "Application""?
>> Looks like overlapping.
>
> They're not.
>
> The first directive (autoloaderNamespaces) is adding an additional
> namespace that the Autoloader will attempt to respond for.
>
> The second directive (appnamespace) is telling Zend_Application the
> prefix used for the application bootstrap (and default module).
>
> The two are quite separate -- the first is intended typically for code
> in your _library_, not within the application; you will usually use a
> resource autoloader within your application code for loading assets
> (forms, view helpers, models, etc.).
>
>> "appnamespace = "Application"" helps load all classes with prefix
>> "Application_Aplication" which are in Zend sibling directory
>> "Application".
>
> Wrong. See above.
>
>> But it doesn't help classes which are right there in "Application"
>> directory, say, with "Application_Form" prefix.
>> Why is it so? Or I miss something?
>
> If your bootstrap extends Zend_Application_Bootstrap or
> Zend_Application_Module_Bootstrap, a resource autoloader using the
> appnamespace directive *should* be loaded for you, giving access to
> those resources. If this is not the case, you'll need to provide better
> detail of your application file structure, and some samples of class
> names found in some of the files -- that information will help us
> troubleshoot better.
>
> --
> Matthew Weier O'Phinney
> Project Lead            | matthew@zend.com
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>

--
Opera.com

没有评论: