Zend Framework: Zend_Db_Table Column Alias Map Component Proposal
| Proposed Component Name | Zend_Db_Table Column Alias Map |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Db_Table Column Alias Map |
| Proposers | Fernando Chucre |
| Zend Liaison | TBD |
| Revision | 1.0 - 30 July 2008: Initial Draft. (wiki revision: 3) |
Table of Contents
1. Overview
Many ORM needs map name of column difent of attribute name of object. Now in the Zend_Db_Table_Row_Abstract it isn't possible. Many developer implements a Zend_Db_Table_Row_Abstract class to make it, and many times these implementation is not good and not produtive. This component make it a way vary simple.
2. References
- Metadata Mapping
- Zend_Db_Table_Abstract
- Zend_Db_Table_Row_Abstract
- Zend_Db_Table_Rowset_Abstract
3. Component Requirements, Constraints, and Acceptance Criteria
- This component will map real column name with different attribute name
- This component will use the method Zend_Db_Table_Row_Abstrac::_transformColumn to make this possible.
- This component will not change signatures of component.
4. Dependencies on Other Framework Components
- Zend_Exception
- Zend_Db_Table_Abstract
- Zend_Db_Table_Row_Abstract
- Zend_Db_Table_Rowset_Abstract
- Zend_Db_Table_Select_Abstract
5. Theory of Operation
The component will continue to operate when called using the method signature. And will provide a new attribute in Zend_Db_Table_Abstract class called$_columnMap. This attribute is an array. The component will provide 4 new methods. A usualy case fallowing. The $_columnMap is a assossiative array and will be like this:
Then package Zend_Db_Table will provide complete translation in all operations, since get and set to translation in clause where in Zend_Db_Select.
6. Milestones / Tasks
- Milestone 1: design notes will be published here
- Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2
- Milestone 4: Unit tests exist, work, and are checked into SVN.
- Milestone 5: Initial documentation exists.
7. Class Index
- Zend_Db_Table_Abstract
- Zend_Db_Table_Row_Abstract
- Zend_Db_Table_Rowset_Abstract
8. Use Cases
| UC-01 |
|---|
Map column by the attribute call $_columnMap.
Table Person:
Using get and set.
| UC-02 |
|---|
Using column translation in $where(Zend_Db_Select_Abstract)
9. Class Skeletons
...
ZF Home Page
Code Browser
Wiki Dashboard