ZF-2441: Loader_PluginLoader should allow loading of classes without using any prefix

Issue Type: Improvement Created: 2008-01-15T20:07:49.000+0000 Last Updated: 2008-11-22T08:57:16.000+0000 Status: Resolved Fix version(s): - 1.7.3 (19/Jan/09)

Reporter: Sebastian Krebs (kingcrunch) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Loader

Related issues: Attachments:


Sometimes it may be useful to not specify a prefix to the path. In my special situation i want to load models with the PluginLoader and I want to follow restrictions made for the Controller, so the Models are name like "Module_BarModel", but for the default-Module it will only called "FooModel". If an empty string is given as prefix _formatPrefix will ever append an underscore

<pre class="highlight">    protected function _formatPrefix($prefix)
        return rtrim($prefix, '_') . '_';

So, if i try to loader "FooModel", it will (at least) search for "_FooModel". It seems to be more useful, if empty strings as prefix will stay empty strings.

<pre class="highlight">    protected function _formatPrefix($prefix)
        return !empty($prefix) ? rtrim($prefix, '_') . '_' : '';


Posted by Wil Sinclair (wil) on 2008-03-31T16:07:17.000+0000

Please evaluate and assign as necessary.

Posted by Matthew Weier O'Phinney (matthew) on 2008-11-22T08:57:05.000+0000

One mission of Zend framework is to establish best practices. One aspect of plugin loading is to promote the idea of namespaced classes that can serve as replacements for existing functionality. These two combined bring us to the recommendation that plugin classes should have class prefixes to prevent naming collisions.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.