ZF-2292: Zend_Auth_Adapter_DbTable authenticate() could be split into subroutines to facilitate subclassing


I've written a DbTable adapter that subclasses from Zend_Auth_Adapter_DbTable, overloading only the authenticate() method. This is standard fare, of course, but I had to duplicate a lot of code within that overload in order to sub it. It would be wonderful to have the authenticate() method split into finer-grained protected methods such as:

protected function _validate # Zend_Auth_Adapter_Exception
protected function _buildAuthResult() # array, or an instance of a new data transfer class?
protected function _sanitizeCredentialTreatment($treatment = "?") # string
protected function _buildCredentialExpression() # Zend_Db_Expr
protected function _buildSelect() # Zend_Db_Select
protected function _doSelect($dbSelect) # array or rowset OR throw Zend_Auth_Adapter_Exception
protected function _validateIdentities($resultIdentities = array()) # Zend_Auth_Result

I will submit a patch as soon as my CLA is faxed and approved, but I thought I'd open dialogue now.

This would make subclassing a lot cleaner and less brittle as Zend_Auth_Adapter_DbTable grows.


I like this idea... Ralph, what do you think?

I like this idea too actually, I think overall we can reduce the authenticate to perhaps 4 sub protected methods, (a lower number would also reduce the number of class properties we'd need to add to maintain state from protected method to protected method)

Resolved in r7598