3

I have two simple tables: Projects and SubProjects which I'd like to print every subproject with the respective project in a table.

So I wrote this:

class Admin_Model_Projects extends Zend_Db_Table_Abstract { protected $_name = 'main_projects'; protected $_primary = 'mai_id'; protected $_sequence = true; protected $_dependentTables = array('Admin_Model_SubProjects'); .... 

And this:

class Admin_Model_SubProjects extends Zend_Db_Table_Abstract { protected $_name = 'sub_projects'; protected $_primary = 'sub_id'; protected $_sequence = true; protected $_referenceMap = array( 'columns' => 'mai_id', 'refTableClass' => 'Admin_Model_Projects', 'refColumns' => 'mai_id' ); ..... 

I'd like to know why do I get No reference from table Admin_Model_SubProjects to table Admin_Model_Projects when I type <?php echo $entry->findParentRow('Admin_Model_Projects'); ?>

2 Answers 2

1

Looks like you're missing name of the rule in your referenceMap definition.
It should be

protected $_referenceMap = array( 'Project' => array( 'columns' => 'mai_id', 'refTableClass' => 'Admin_Model_Projects', 'refColumns' => 'mai_id' ) ); 
Sign up to request clarification or add additional context in comments.

Comments

0

You should define $_referenceMap and $_dependentTables in all of the related table-classes. It will look close-to mirrored when you're done.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.