Where to put custom functions in Zend Framework 1.10
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
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
精彩评论