开发者

findAllThreaded cakephp

开发者 https://www.devze.com 2023-01-24 09:09 出处:网络
i\'ve been reading about this find method call findAllThreaded() in cakephp but i try it and it doesnt work... im working with 1.3 v of 开发者_JAVA技巧cake,,,

i've been reading about this find method call findAllThreaded() in cakephp but i try it and it doesnt work... im working with 1.3 v of 开发者_JAVA技巧cake,,,

Do i have to download some code?


This depends heavily on your table structures, but check out find('threaded', ...)

http://book.cakephp.org/view/1023/find-threaded


No you do not need to download code but you might want to consider using the tree behavior. If using the tree behavior you will need to add this to your model:

public $behaviors = array('Tree');

Then in your database table you will need to add three columns parent_id, lft and rght, all three values should be unsigned integers.

However it is possible to get results using find('threaded') with just a parent_id, but I usually use the Tree Behavior.


Please check the naming conventions of foreign key ,it should be according to the cakePHP namig conventions.

0

精彩评论

暂无评论...
验证码 换一张
取 消