Recursive option like CakePHP in zend framework

守給你的承諾、 提交于 2019-12-11 23:25:27

问题


i am new in zend framework i want the same functionality in zend framework like recursive which i am using in cake php. any one can help me to implement this in zend framework ? anyone know how to implement the same thing in zend framework ?


回答1:


The recursive property defines how deep CakePHP should go to fetch associated model data via find(), findAll() and read() methods.
Imagine your application features Groups which belong to a domain and have many Users which in turn have many Articles. You can set $recursive to different values based on the amount of data you want back from a $this->Group->find() call:
Depth   Description
-1  Cake fetches Group data only, no joins.
0   Cake fetches Group data and its domain
1   Cake fetches a Group, its domain and its associated Users
2   Cake fetches a Group, its domain, its associated Users, and the Users' associated Articles
Set it no higher than you need. Having CakePHP fetch data you aren’t going to use slows your app unnecessarily. Also note that the default recursive level is 

If this is what you are asking about, you can have it or something like it as soon as you code it or install an ORM like Doctrine. :)
The best you're likely to do with vanilla ZF is something like findDependentRowset() or findParentRow().
ZF gives you the tools to build what you need it's not a black box style framework like some others. However it's usually not to hard to bolt on libraries and third party tools.



来源:https://stackoverflow.com/questions/9211032/recursive-option-like-cakephp-in-zend-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!