Welcome Guest, Not a member yet? Register   Sign In
recommendations on ORM vs custom data mapper
#5

[eluser]Chillahan[/eluser]
[quote author="cahva" date="1304951584"]To answer to the question if there are other options, there is DataMapper ORM which I've used couple of times in my projects and can recommend it. Test it out to see if it fits to your project(s).[/quote]

I looked at DataMapper but it seemed discontinued - I did find a release date from January of this year in the link you sent, so I guess I was unsuccessful in finding the updated version!

How does DataMapper compare to Doctrine? To me it seems Doctrine is more well-established, more likely to stay alive - is the downside that Doctrine is slower/heavier/cumbersome to use? What about Doctrine 2.0 (I have yet to research that option)?

And what about my original question - how do I best encapsulate business functionality? Is it by using an ORM and overloading the default get/set methods, or using a custom library (and within that, either using regular CI database model or use ORM within)?

Here's an example - let's say I have a set of classes on offer. Before I can publish the next tutorial in a class, I need to make sure no one has not passed the previous class, with a pass being an average number of correct answers on a quiz for that class. But if someone didn't take the quiz and the deadline is past, their failing score should not keep the class back. Likewise, if someone fails twice in a row, they should not hold the class back.

Here are different approaches I see (with pseudo-code):

I. script-style - controller handles business logic of performing all these checks, by using simple method calls for the class in question:

if count_failed_grades($classID) == '0' (and inside that query handle a sub query for expired deadlines)

II. object style, using library with regular CI model -

$myClass = new Class($classID)
if $myClass.countFailedGrades == '0' (and inside class, same logic as above)

III. object style, using library with custom data mapper or ORM -

$myClass = new Class($classID)
if $myClass.countFailedGrades == '0'
...inside library class...
constructor($classID):
$this.grades = $ORM->grades->retrieveAllbyClassID($classID);
function countFailedGrades()
... iterate through grades object collection ...


Thoughts?


Messages In This Thread
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 12:04 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 12:11 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 03:33 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 11:34 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 11:45 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 01:44 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 01:54 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 01:56 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 02:08 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 02:10 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 03:04 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 05:47 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 09:11 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-09-2011, 11:50 PM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 12:23 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 12:53 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 12:59 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 03:31 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 05:03 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 05:08 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 07:15 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 07:19 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 07:29 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 08:10 AM
recommendations on ORM vs custom data mapper - by El Forum - 05-10-2011, 10:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB