Zend Framework

Zend_Db forces 'naming convention'

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.9.3
  • Component/s: Zend_Db
  • Labels:
    None

Description

Here's my setup:

config.ini
db.params....
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.

Activity

Hide
Dolf Schimmel (Freeaqingme) added a comment -

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

Show
Dolf Schimmel (Freeaqingme) added a comment - 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).
Hide
Josh Butts added a comment -

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

Show
Josh Butts added a comment - @Dolf agree this is a Zend_Loader issue, and even then, not really an issue.
Hide
Ralph Schindler added a comment -

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'];
            }
            unset($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.

Show
Ralph Schindler added a comment - 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'];
            }
            unset($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.
Hide
Ralph Schindler added a comment -

Fixed with the solution in ZF-5606

Show
Ralph Schindler added a comment - Fixed with the solution in ZF-5606

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: