I am using Zend 1.8. I have two tables, one parent and one dependant. The inferential integrity is defined at the table level.
I do a couple of select and everything works fine. When I try to get the dependantrowset however, I get an error. In the 'findDependentRowset' method, I'm supposed to tell it the name of the class of the dependant table. The name of that class is Model_DbTable_CostTreePath and it's in the Models folder in my structure. I get an error message in the logs saying:
include(CostTreePath.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /Library/WebServer/Documents/Zend/library/Zend/Loader.php on line 83
I know it's trying to find the file corresponding to the class of my dependant table. I'm not quite sure how to do this however. Can anyone shed some light on this?
Thanks.
here's the relevant extract of my code: ( I don't need to declare dependant table as I do that at the database level)
Parent table:
- Code: Select all
class Model_DbTable_Tree extends Zend_Db_Table_Abstract
{
protected $_schema = 'test-company'; //Implementer registry et aller chercher le nom de la db pour chaque compagnie dans le registry
protected $_name = 'tree';
protected $_primary = 'node_id';
protected $_sequence = true;
......
dependant table:
- Code: Select all
class Model_DbTable_CostTreePath extends Zend_Db_Table_Abstract
{
protected $_schema = 'test-company'; //Implementer registry et aller chercher le nom de la db pour chaque compagnie dans le registry
protected $_name = 'CostTreePath';
protected $_primary = array('ancestor_id','descendant_id');
protected $_referenceMap = array(
'Ancestor' => array(
'columns' => 'ancestor_id',
'refTableClass' => 'tree',
'refColumns' => 'node_id'
),
'Descendant' => array(
'columns' => 'descendant_id',
'refTableClass' => 'tree',
'refColumns' => 'node_id'
),
);
........
The dependant table's model's controller:
- Code: Select all
<?php
class CostTreePathController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$this->view->title = "Budget Objects - TreePath view";
$this->view->headTitle($this->view->title, 'PREPEND');
$tree = new Model_DbTable_Tree();
$Rowsetnew = $tree->find(5);
$Row1 = $Rowsetnew->current();
$relatedRows = $Row1->findDependentRowset('Model_DbTable_CostTreePath', 'Ancestor');
$this->view->treePath = $treepath;
}
}

