brianlange Posted November 29, 2010 Share Posted November 29, 2010 I'm working with the zend framework. I've implemented the quickstart tutorial that uses that data mapper pattern. I am now reading about using a service layer. Does the service layer serve as the mapper class? In other words are they exclusive? Or could an application have both a service layer and a data mapper class? Quote Link to comment https://forums.phpfreaks.com/topic/220161-service-layer-and-the-data-mapper-pattern/ Share on other sites More sharing options...
ignace Posted November 30, 2010 Share Posted November 30, 2010 They are not mutually exclusive. A Service Layer could use a Data Mapper for example. A Service Layer encapsulates your services like a Facade encapsulates your sub-system(s). Quote Link to comment https://forums.phpfreaks.com/topic/220161-service-layer-and-the-data-mapper-pattern/#findComment-1141313 Share on other sites More sharing options...
shlumph Posted November 30, 2010 Share Posted November 30, 2010 Exactly what ignance mentioned. Your service layer should handle model creation. It should pull a lot of that logic out of your controllers. If you want, you can take a look at an example I have on github: https://github.com/rkeplin/Blog/tree/master/application/services/ Quote Link to comment https://forums.phpfreaks.com/topic/220161-service-layer-and-the-data-mapper-pattern/#findComment-1141361 Share on other sites More sharing options...
brianlange Posted November 30, 2010 Author Share Posted November 30, 2010 Thanks for the responses. Quote Link to comment https://forums.phpfreaks.com/topic/220161-service-layer-and-the-data-mapper-pattern/#findComment-1141486 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.