Where to put custom functions in Zend Framework 1.10

烂漫一生 提交于 2020-01-14 02:09:50

问题


I have to use custom functions / objects in my web application based on Zend Framework 1.10. Where is the best place to put them ?

Thanks in advance


回答1:


The objects you describe belong to the Model, so they go in application/models. Remember that the Model is everything that is not pertaining to the presentation layer (e.g. the V and C in MVC). My suggestion would be to have this structure then:

application
- models
-- my            -> to indicate this is yours
--- persistence  -> contains all classes that capsulte Data access logic
--- domain       -> business objects in your domain of application
--- service      -> services that use the domain objects or the persistence layer
--- mappers      -> your ORM layer (unless you are not using Doctrine anyway)

If you have classes that are generic enough to be reused in other applications, you can place them into the /lib folder. But everything specifically made for your app should go in models.

Also, have a look at the ZFPlanet Sample Project by Padraic Brady



来源:https://stackoverflow.com/questions/3263910/where-to-put-custom-functions-in-zend-framework-1-10

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