Added by Jason Eisenmenger, last edited by Ralph Schindler on Nov 01, 2008  (view change)

Labels

 
(None)

Zend Framework: Zend_Auth_Adapter_Doctrine_Table Component Proposal

Proposed Component Name Zend_Auth_Adapter_Doctrine_Table
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Auth_Adapter_Doctrine_Table
Proposers Jason Eisenmenger
David A. Werner
Zend Liaison Ralph Schindler
Revision 1.0 - 16 June 2008: Working Draft. (wiki revision: 8)

Table of Contents

1. Overview

Zend_Auth_Adapter_Doctrine_Table is an authentication adapter for Zend_Auth to use the Doctrine DBAL

You may download the most up-to-date class here.

2. References

  • [Zend_Auth_Adapter_Dbtable]

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will provide the exact same functionality as Zend_Auth_Adapter_DbTable
  • This component will support Doctrine's query conventions in the adapter methods.

4. Dependencies on Other Framework Components

  • Zend_Auth_Adapter_Interface
  • Zend_Auth_Result
  • Zend_Auth_Adapter_Exception
  • Doctrine_Connection_Common
  • Doctrine_Query

5. Theory of Operation

This component is used exactly the same way as Zend_Auth_Adapter_DbTable, with the added functionality of using Doctrine's preferred way of casting names.

6. Milestones / Tasks

  • Milestone 1: [DONE] Initial proposal published for review with working prototype. (See overview for link)
  • Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
  • Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
  • Milestone 4: Unit tests exist, work, and are checked into SVN.
  • Milestone 5: Initial documentation exists.

7. Class Index

  • Zend_Auth_Adapter_Doctrine_Table

8. Use Cases

UC-01

UC-02

 

9. Class Skeletons

While creating this, David and I realized that we could nearly directly copy the current DbTable with little modification. Which we ended up doing There are probably a total of only 30 lines difference between the two without counting changing all instances of DbTable to Doctrine_Record.

This brings up the issue of alot of the code in both being extended from elsewhere, perhaps into a Zend_Auth_Adapter_Dbal.php or some such.

Looking good, but I would make the connection optional, since it's optional in most parts of Doctrine

Yeah, connection should be optional, and not the first parameter. In my opinion connection should be retrieved using $conn = Doctrine::getConnectionByTableName($tableName), if it is absolutely needed.

The connection parameter has been made optional, and follows Robin Skoglund's suggestion in an added getConnection() method.

Do you think this method should throw an exception rather than return null?

Or perhaps the exception should be thrown if null is returned during authentication?

Zend Official Response

This proposal is accepted to the Zend Extras Incubator for development.

We would like to see the following concerns met:

  • This proposal and the proposal for Zend_Paginator_Adapter_Doctrine are combined into the ZendX_Doctrine namespace.
  • Name changed to ZendX_Doctrine_Auth_Adapter or ZendX_Doctrine_Auth_Adapter_DbTable
  • With this ZendX_Doctrine namespace, we would like to explore the possibility of allowing the top level class (presumably ZendX_Doctrine) to set up (bootstrap) this component for usage with doctrine- as well as checks to ensure that doctrine is available for use.