2009年9月21日星期一

[fw-db] How to get date from a Zend_Db_Table_Row class

This is my Db table structuer.
http://www.nabble.com/file/p25530196/articlek.jpg

I create ArticleRow class by extending Zend_Db_Table_Row_Abstract for get
section and category names instead of section_id and category_id ,And user
names instead of author_id and modified_by from Article Zend_Db_Table class.

I add "protected $_rowClass = 'ArticleRow';" to Article class and for init()
method of ArticleRow(Zend_Db_Table_Row) I add

$articleTb= new App_Model_Article();
$articleRow=$articleTb->select();
$articleRow->from( 'article');

$articleRow->join('section','section_id=section.id',array('section_name'=>'section.title'));
$articleRow->join('category','category_id=category.id',array('category_name'=>'category.title'));

$articleRow->join('user','author_id=user.id',array('author_name'=>'user.name'));

But I don't know how to get a the data of a specific row by passing id value
from a controller.
Please help me.Thank you.

--
View this message in context: http://www.nabble.com/How-to-get-date-from-a-Zend_Db_Table_Row-class-tp25530196p25530196.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: