Zend Framework 和嵌套集
我们目前正在基于 Zend Framework 开发自己的 ShopProducts Feedmanager。 在此 feedmanager 中,您可以管理多个要创建并发送到不同位置的 feed。 每个提要都有 n 个字段,这些字段在当前版本中仅存在于一个级别中。 现在我们想将其更改为多级版本,我们有父字段和子字段。
我们不想重新发明轮子,所以我们想使用开发的类或助手。
我找到了 F. Pietka 的班级。 https://github.com/fpietka/Zend-Nested-Set 我尝试在我们的系统中使用这个助手,但没有成功。
我编写了以下行来使用该类:
$oNested = new NestedSet_Model();
我收到以下错误消息:
致命错误:调用未定义的方法 NestedSet_Model::getDbTable() D:\xampp\htdocs\feedmanager_alpha\application\classes\NestedSet.class.php 第75行
Peitka 的 NestedSet 帮助程序的自述文件中,它说 ZendLibrary 需要位于包含路径中。
我想我是用以下几行做到的:
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)
)
)
);
我是否正确设置了包含路径? 我的情况可能是什么问题? 嵌套集是创建父子模型的最佳方式吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我强烈建议你不要使用这个类,因为它显然是一个 WIP。但是,如果您想避免此错误,只需删除 __construct() 方法并手动调用 setDb() 和 setTableName() 即可。
例子:
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:
早就该了,但我更新了 https://github.com/fpietka/Zend-Nested-Set (即使有单元测试)。
随意创建问题!
It was long overdue, but I updated https://github.com/fpietka/Zend-Nested-Set (even with unit tests).
Feel free to create issues!