ZF-6966: Zend_Db forces 'naming convention'

Issue Type: Bug Created: 2009-06-09T07:40:55.000+0000 Last Updated: 2009-09-20T14:57:04.000+0000 Status: Resolved Fix version(s): - 1.9.3 (22/Sep/09)

Reporter: Till Klampaeckel (till) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db

Related issues: Attachments:


Here's my setup:

<pre class="highlight">
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.


Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-06-09T07:50:34.000+0000

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).

Posted by Josh Butts (jimbojsb) on 2009-08-17T11:50:49.000+0000

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

Posted by Ralph Schindler (ralph) on 2009-08-17T12:36:57.000+0000

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

<pre class="highlight">
         * 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.

Posted by Ralph Schindler (ralph) on 2009-09-20T14:57:04.000+0000

Fixed with the solution in ZF-5606

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.