Thanks for the response.  I'll pop an item into the issue tracker later this
afternoon.


Matthew Weier O'Phinney-3 wrote:
> 
> -- thurting <[email protected]> wrote
> (on Friday, 01 May 2009, 05:13 PM -0700):
>> I've run into some issues with resources and wanted to run them by you:
>> 
>> 1.  In the docs
>> (http://framework.zend.com/manual/en/zend.application.examples.html) it
>> states that I could config a resource using the following:
>> 
>> $application = new Zend_Application(
>>     APPLICATION_ENV,
>>     array(
>>         'resources' => array(
>>             'My_Bootstrap_Resource_View' => array(), // full class name;
>> OR
>>             'view' => array(),                       // short name
>> 
>>             'FrontController' => array(
>>                 'controllerDirectory' => APPLICATION_PATH .
>> '/controllers',
>>             ),
>>         ),
>> 
>>         // For short names, define resource paths:
>>         'resourcePaths = array(
>>             'My_Bootstrap_Resource' => 'My/Bootstrap/Resource',
>>         )
>>     )
>> );
>> 
>> Unfortunately, this doesn't seem to work.  First the "resourcePaths"
>> variable doesn't seem to do anything.  I think it should be
>> "pluginPaths",
>> so you may want to fix that.  
> 
> I've fixed this in trunk and the 1.8 release branch, and it will update
> on the site with 1.8.1. Thanks for the report.
> 
>> In any case, the major issue I notice is with referencing a resource
>> by full class name.  This simply does not work, and the plugin loader
>> will throw an exception at line 392, as the matching plugin will not
>> be found - the reason of course being that the plugin loader appends
>> the path prefix to the class name on line 362.  So, the only solution
>> is to use the shorthand notation (e.g. 'view'), 
> 
> Could you file a report for this, please? I have a pretty good idea as
> to why it's not working, but I'd like a place to publically track it.
> 
>> but this can lead to problems.  Take the following example:
>> 
>> Let's say my application contains two libraries in addition to the core
>> Zend
>> library - let's call them Lib1 and Lib2.  Now, let's say both libraries
>> define resources named Db and View.  I add both Lib1 and Lib2 to my
>> plugin
>> path (i.e. Lib1_Application_Resource =>
>> /library/Lib1/Application/Resource
>> and Lib2_Application_Resource => /library/Lib1/Application/Resource),
>> with
>> Lib2 being added last and therefore checked first when the plugin loader
>> runs.  Now, in my config I can't use full class name notation, so when I
>> set
>> up these resources I have to write something like:
>> 
>> resources.db =
>> resources.view =
>> 
>> Here is the problem ... let's say I want to use the Lib1 Db resource and
>> the
>> Lib2 View resource ... how can I do this?  Since I'm locked into the
>> shorthand notation, it seems that because Lib2 will be the first path
>> checked by the plugin loader, I'm stuck having to use both the Lib2 Db
>> and
>> Lib2 View resources.  
> 
> That's how plugin paths are supposed to work -- if a resource exists on
> multiple plugin paths, the first path scanned (which is the last
> registered) wins.
> 
> Which is why I'd like you to log the issue report I requested above, as
> it is the obvious workaround -- simply specify the full class name when
> you want to use a specific resource class.
> 
> -- 
> Matthew Weier O'Phinney
> Project Lead            | [email protected]
> Zend Framework          | http://framework.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Application-resource-config-issue-tp23341727p23348294.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to