Issues

ZF-5957: Expose underlying Zend_Db_Select for Zend_Auth_Adapter_DbTable

Description

Currently the underling DB Select object used for db-table auth is not exposed through a getter method.

Suggest changing:

    $dbSelect = $this->_zendDb->select();

To $dbSelect = $this->getSelect();

and adding a getSelect public method.

Purpose: to add additional clauses/predicates to the authentication -- eg an enabled true/false.

Comments

Can you add the proposed use case code?


$adapter = new Zend_Auth_Adapter_DbTable(
                   $db,
                   'users',
                   'username',
                   'password',
                   'md5(?)'
                 );

$adapter->setIdentity($params->username)
                ->setCredential($params->password);

$adapter->getSelect()->where('enabled = ?', true);

Added in r14892 to trunk

The added method name is getPreauthenticationDbSelect(), its been asked to shorten it to getDbSelect(), ... there are a couple of reasons for the length and conciseness of name: * this method name spells out that the select object is provided pre-authentication time and will not contain any of the identity and credential information * on subsequent retrieval of this object (Even after an authenticate() call), the object will retain the same state that it had prior to any of the previous authenticate() calls * this method is considered advanced usage, and developers should fully understand it before using it. the longevity of the name is an attempt at discouraging "drive-by" usage.

Why not "getDbAuthSelect()"?