Welcome Guest, Not a member yet? Register   Sign In
What is the best way to write "delete" functions in a model?
#2

[eluser]Jelmer[/eluser]
I'm using a similar setup (though with RapidDataMapper instead of Active Record). My base model contains general functions which could work on all tables, but when I implement the base model for different tables I configure them by overwriting the parent function but almost always still use it in the end (the new function does some checking and configuring, the actual deleting is done by the parent).

Also I limit the usage of my general update and delete functions to work solely by ID. That prevents many mistakes, like the one you mentioned. If there's a reason I might need a function to work on multiple rows I write specialized functions for that instead of using the general ones, mainly because I don't need such functions very often and they're very prone to mistakes.


Messages In This Thread
What is the best way to write "delete" functions in a model? - by El Forum - 09-06-2010, 05:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB