tag:blogger.com,1999:blog-3827986091291063109.post7035873211943829204..comments2023-05-10T02:04:36.067+01:00Comments on Always Learning: Active Record vs Data Mapper for PersistenceAnonymoushttp://www.blogger.com/profile/17663647809732553575noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-3827986091291063109.post-62107876088051117602015-09-11T08:57:42.110+01:002015-09-11T08:57:42.110+01:00My understanding (and I am not an expert on the su...My understanding (and I am not an expert on the subject), is that where you have complex queries, perhaps involving multiple domains, you can use a repository pattern to deal with collections of objects, and data mappers for individual object mapping. Service objects handle a discrete business task and would call either the repository or data mapper as needed.Anonymoushttps://www.blogger.com/profile/17663647809732553575noreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-82112685606292364922015-09-11T03:26:49.169+01:002015-09-11T03:26:49.169+01:00This "service object" approach looks an ...This "service object" approach looks an awful lot like the repository pattern to me...am I missing something?Adrian Günternoreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-62668908520089403872015-03-27T11:03:03.049+00:002015-03-27T11:03:03.049+00:00very nice post. thank youvery nice post. thank youAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-16809660554376308462015-02-23T08:08:54.541+00:002015-02-23T08:08:54.541+00:00ThanksThankslazykatehttps://www.blogger.com/profile/08433198845453242862noreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-15908276484745407612015-01-27T22:42:52.027+00:002015-01-27T22:42:52.027+00:00Nice post. Clear and useful. Thanks! :)
- DanielNice post. Clear and useful. Thanks! :)<br /><br />- DanielAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-56036178649364929902014-07-03T10:25:02.255+01:002014-07-03T10:25:02.255+01:00so GOOD!so GOOD!阿川https://www.blogger.com/profile/01776399695037003154noreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-3382718324238389742014-06-19T16:32:23.812+01:002014-06-19T16:32:23.812+01:00Thanks, I'm glad you found it useful.Thanks, I'm glad you found it useful.Anonymoushttps://www.blogger.com/profile/17663647809732553575noreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-29817328994356563242014-06-19T16:01:47.426+01:002014-06-19T16:01:47.426+01:00This is a great post, Russell. I got a very clear ...This is a great post, Russell. I got a very clear picture of the differences.Anonymoushttps://www.blogger.com/profile/03482773592270750980noreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-13969289294769592482014-01-01T08:57:02.818+00:002014-01-01T08:57:02.818+00:00Doctrine 2 uses the data mapper pattern (and by ex...Doctrine 2 uses the data mapper pattern (and by extension, Symfony 2). I tend to use annotations in my entities to define the mapping characteristics, which I guess could be seen as a pollution of the pattern, but you can use yaml or xml and keep your entities completely separate from the mapping.Anonymoushttps://www.blogger.com/profile/17663647809732553575noreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-77284581529332346422013-12-31T22:29:37.961+00:002013-12-31T22:29:37.961+00:00I've seen a lot of mistaken use of design patt...I've seen a lot of mistaken use of design pattern names applied to PHP libraries. Is there a library for PHP that implements the true data mapper design pattern as Martin Fowler defines it?Ted Henrynoreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-11242367040858440842013-10-22T15:18:33.583+01:002013-10-22T15:18:33.583+01:00I'm afraid I don't have time right now to ...I'm afraid I don't have time right now to elaborate (maybe in a future post), but here are a couple of links you might find helpful:<br /><br /><a href="http://stevelorek.com/service-objects.html" rel="nofollow">http://stevelorek.com/service-objects.html</a><br />(talking about Rails, but the principles still apply - when using the controller to co-ordinate things, it can become a 'fat controller')<br /><br /><a href="http://akrabat.com/php/objects-in-the-model-layer-part-2/" rel="nofollow">http://akrabat.com/php/objects-in-the-model-layer-part-2/</a><br />(an example of using service objects and data mappers in PHP)Anonymoushttps://www.blogger.com/profile/17663647809732553575noreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-86632631568408759482013-10-22T13:11:46.057+01:002013-10-22T13:11:46.057+01:00Could you please elaborate on the Service Object t...Could you please elaborate on the Service Object topic a little, for example give some sample code of having to deal with both mapper and model in the controller, the model leaking into the controller, and how it would look when doing it using Service Objects instead? Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-33226399728134273782013-10-19T13:06:08.564+01:002013-10-19T13:06:08.564+01:00Whether using active record or data mapper, I woul...Whether using active record or data mapper, I would typically use a collection class for lists of objects - with active record, the collection class would include its own load method.Anonymoushttps://www.blogger.com/profile/17663647809732553575noreply@blogger.comtag:blogger.com,1999:blog-3827986091291063109.post-28081787015295165332013-10-18T20:41:31.927+01:002013-10-18T20:41:31.927+01:00Hello, thanks for the Post.
In case of Active Rec...Hello, thanks for the Post. <br />In case of Active Record, how you recommend to handle the list of rows/objects?, meaning the SELECTs part. In the same class?<br />Anonymousnoreply@blogger.com