Hi,

First, thanks for 1.8 - you guys rock!  Second, I took a dive in today and
started playing around with Zend_Application and all the related goodies. 
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.  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'), 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.  I guess I could create wrappers in the form of Lib3,
but that seems like a pain and isn't really flexible if I want to be able to
mix and match based on app environment or other cases. In addition I could
create _init* methods in the bootstrap that explicitly instantiate resource
instances, but I would lose the ease of use of the Application config and
would have to make sure to properly set up the resource as is done in
pluginResource section of the _executeResource method in
Application/Bootstrap/BootstrapAbstract.php.

Sorry for the mouthful.  Any input?
-- 
View this message in context: 
http://www.nabble.com/Zend_Application-resource-config-issue-tp23341727p23341727.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to