|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
joining Table Zend_Db_Table_Abstract and getting valueshi,
I am trying to join two tables my blog_post table has field 'post_category' Which contains number and that is related to my 'blog_category' table with the text, its like id-value pair blog_post Blog_category '1' 'general' But I cannot join table and fetch related data. Below is the information, your help is highly appreciated, thanks I have two tables in a database -> Blog_posts ('id' ,'post_category','post_title','post_content') -> Blog_category ('term_id','name') My model class is as below class Blog extends Zend_Db_Table_Abstract { protected $_name = 'blog_posts'; protected $_dependentTables = array('Blog_Category'); } class Blog_Category extends Zend_Db_Table_Abstract { protected $_name = 'blog_category'; protected $_referenceMap = array( 'Blog' => array( 'columns' => array('term_id'), 'refTableClass' => 'blog', 'refColumns' => array('post_category') ) ); } My controller is as below $blog1 = new Blog(); $row = $blog1->fetchRow('id = 1'); $this->view->cat = $row->findDependentRowset('Blog_Category'); but I get this error message Fatal error: Uncaught exception 'Zend_Db_Table_Exception' with message 'No reference from table Blog_Category to table Blog'…… …………………………………… Zend_Db_Table_Abstract->getReference('Blog', NULL) #1 thanks for your help |
|
|
Re: joining Table Zend_Db_Table_Abstract and getting valuesfossil schrieb:
> hi, > I am trying to join two tables > my blog_post table has field 'post_category' Which contains number and that > is related to my > 'blog_category' table with the text, its like id-value pair > > blog_post Blog_category > '1' 'general' > > But I cannot join table and fetch related data. > Below is the information, your help is highly appreciated, thanks > > I have two tables in a database > > -> Blog_posts ('id' ,'post_category','post_title','post_content') > -> Blog_category ('term_id','name') > > > My model class is as below > > class Blog extends Zend_Db_Table_Abstract { > protected $_name = 'blog_posts'; > protected $_dependentTables = array('Blog_Category'); > > } > > class Blog_Category extends Zend_Db_Table_Abstract { > protected $_name = 'blog_category'; > protected $_referenceMap = array( > 'Blog' => array( > 'columns' => array('term_id'), > 'refTableClass' => 'blog', > 'refColumns' => array('post_category') > ) > ); > } > > > > > My controller is as below > > $blog1 = new Blog(); > $row = $blog1->fetchRow('id = 1'); > $this->view->cat = $row->findDependentRowset('Blog_Category'); > > > but I get this error message > > Fatal error: Uncaught exception 'Zend_Db_Table_Exception' > with message 'No reference from table Blog_Category to table Blog'…… > …………………………………… Zend_Db_Table_Abstract->getReference('Blog', NULL) #1 > > > thanks for your help > integretycheck to false. $db->select()->setIntegrityCheck(false) see dokumentation for zend_db_select for more info |
|
|
Re: joining Table Zend_Db_Table_Abstract and getting valuesIs the refTablClass case sensitive?
class Blog_Category extends Zend_Db_Table_Abstract { protected $_name = 'blog_category'; protected $_referenceMap = array( 'Blog' => array( 'columns' => array('term_id'), 'refTableClass' => 'blog', 'refColumns' => array('post_category') ) ); } Shouldn't it be 'Blog'? On Thu, Jun 26, 2008 at 12:35 AM, fossil <fossil_007@...> wrote:
-- Cory Wiles kwylez@... http://www.corywiles.com http://www.400mtogo.com |
|
|
Re: joining Table Zend_Db_Table_Abstract and getting valuesHi kwylez , Michael Stoiber
Thank you for your time and help kwylez i just changed from 'blog' to 'Blog' and bravo!! it started to work great!!! thanks a lot
|
| Free embeddable forum powered by Nabble | Forum Help |