I am looking for use cases of people using Zend_Db_Table for their
modeling needs.
Specifically, the easiest use case would be an inheritance paradigm, like:
/controllers/
/models/
/BlogPosts.php [class BlogPosts extends Zend_Db_Table_Abstract]
/BlogPost.php [class BlogPosts extends Zend_Db_Table_Row_Abstract]
/BlogComments.php [class BlogComments extends Zend_Db_Table_Abstract]
/BlogComment.php [class BlogComments extends Zend_Db_Table_Row_Abstract]
/views/
Naturally, the model/row specific class would contain business logic,
and the table class would contain other "buiness search" logic.
Another approach I've seen talked about on the list is that of Data
Mapping. This has also been known as the method for decoupling business
logic from storage mechanism, as well as implementing a gateway pattern.
I imagine the file structure would look like this:
/controllers
/models
/BlogPost.php [class BlogPost]
/BlogPost/
/Table.php [class BlogPost_Table extends Zend_Db_Table_Abstract]
/Row.php [class BlogPost_Row extends Zend_Db_Table_Row_Abstract]
/Rowset.php [class BlogPost_Rowset extends Zend_Db_Table_Rowset
Abstract]
/views
The biggest question in this paradigm is, how do you manage translating
rowset/row objects back into your "Data Model" object.
If anyone has code examples, and/or real world cases, I'd like to see
them :)