0

we`re currently developing our own Feedmanager for ShopProducts based on Zend Framework. In this feedmanager you can manage several feeds, to be created and sent to different locations. Each feed has n-fields which are in the current version only in one level. Now we want to change it to a multilevel version, we we have parentfields and childfields.

We dont want to reinvent the wheel, so we would like to use a developed class or helper.

I found the class of F. Pietka. https://github.com/fpietka/Zend-Nested-Set I tried to use this helper in our system, but had no success.

I wrote the following line, to use the class:

$oNested = new NestedSet_Model();

I got the following error message:

Fatal error: Call to undefined method NestedSet_Model::getDbTable() in D:\xampp\htdocs\feedmanager_alpha\application\classes\NestedSet.class.php on line 75

In the readme of Peitka`s NestedSet helper it says that the ZendLibrary needs to be in the include path.

I think I did this with the following lines:

define("ROOTPATH", realpath("../"));
define("LIBPATH", ROOTPATH . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR);

// Ensure library/ is on include_path
set_include_path(
    implode(PATH_SEPARATOR,
        array(
            realpath(LIBPATH)
        )
    )
);

Did I set the include path correctly? What could be the problem in my case? Is a nested-set the best way to create the parent-child-model?

2
  • This doesn't look like there is something wrong with the include path. The error states that the class NestedSet_Model does not have the function/method called getDbTable(). It can find the class fine, it's the method call that errors. Are you sure this class has that method? Commented Nov 29, 2011 at 22:41
  • Hey jakenoble, at first: thanks for your comment. The class NestedSet_Model doesnt have this method. I thought this Class is complete? How could nobody else have recongnized this missing function? Commented Nov 30, 2011 at 6:39

3 Answers 3

1

I would strongly advise you not to use this class, because it's clearly a WIP. However, if you want to circumvent this error, you can just delete the __construct() method and call the setDb() and setTableName() by hand.

Example:

$model = new NestedSet_Model();
$model->setDb(Zend_Db_Table::getDefaultAdapter());
$model->setTableName('table_name');
Sign up to request clarification or add additional context in comments.

1 Comment

Can you recommend other (better) class for handling nested sets in zend framework?
0
class NestedSet extends Zend_Db_Table
{
    protected $_name = 't_nested_set_mkb_10';

    public function set(){
        $model = new NestedSet_Model();
        $model->setDb(Zend_Db_Table::getDefaultAdapter());
        $model->setTableName('t_nested_set_mkb_10');
    }
}

Comments

0

It was long overdue, but I updated https://github.com/fpietka/Zend-Nested-Set (even with unit tests).

Feel free to create issues!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.