trouble with findDependentRowset

For programming and general questions on Zend Framework

trouble with findDependentRowset

Postby simpli on Tue Jun 09, 2009 11:59 am

Hi,
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;
    }
}

simpli
 
Posts: 33
Joined: Sat Jun 06, 2009 9:40 pm

Re: trouble with findDependentRowset

Postby brunitto on Tue Jun 09, 2009 1:30 pm

To start, your refTableClass key from $_referenceMap should be the referenced table class full name - Model_Db_Table_Tree.

Post your files structure as well.

:)
Ookie dookie!
brunitto
 
Posts: 111
Joined: Fri May 29, 2009 10:10 pm
Location: São Paulo - Brazil

Re: trouble with findDependentRowset

Postby simpli on Wed Jun 10, 2009 3:03 am

That works.
Thank you very much. Is there a solve button.
JR
simpli
 
Posts: 33
Joined: Sat Jun 06, 2009 9:40 pm


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 8 guests