ZF-6966: Zend_Db forces 'naming convention'


Here's my setup:

db.params.adapter = vendor_Db_Adapter_XXX

Whenever I use this, Zend_Db::factory() does not honor my naming convention, but instead forces an upper case letter, thus making it {{Vendor_Db_Adapter_XXX}}, instead of {{vendor_Db_Adapter_XXX}} which leads to an error ({{Zend_Loader}} can't find the class, etc.).

The quickfix is of course an include statement, which doesn't hurt anyway since I am using my custom adapter on each request, but I wanted to file this bug anyway to get it fixed. Wouldn't hurt to be more open in this case. I also know sure that this cannot be introduced/changed without breaking BC.


Isn't this an issue with Zend_Loader rather than Zend_Db? Anyways, Zend_Loader is based on the ZF naming conventions. If you want to deviate from that I suppose you'll need to use your own autoloader (or try the fallback autoloader).

@Dolf agree this is a Zend_Loader issue, and even then, not really an issue.

The problem is with the code in the factory that does this:

         * Form full adapter class name
        $adapterNamespace = 'Zend_Db_Adapter';
        if (isset($config['adapterNamespace'])) {
            if ($config['adapterNamespace'] != '') {
                $adapterNamespace = $config['adapterNamespace'];
        $adapterName = strtolower($adapterNamespace . '_' . $adapter);
        $adapterName = str_replace(' ', '_', ucwords(str_replace('_', ' ', $adapterName)));

Unfortunately, we cannot fix this until 2.0 time. I would postpone, but the likelyhood of this exact code making it into 2.0 is highly unlikely since 2.0 will more than likely take advantage of real namespaces.

As Dolf mentioned above, this can be handled with a custom Zend_Loader_Autoloader.

Fixed with the solution in ZF-5606