Ben Oberholzer Wed Jun 08 11:05:15 -0400 2011

Subject: functions within models

I'm kind of new to this model idea. Is there any reason I can't add functions to my models, therefore treating them like normal classes?


Nanne Huiges Fri Jun 10 03:31:32 -0400 2011

I'd assume you can, but in the very least you've got to be really carefull not to overwrite / reuse some of the default stuff AR has.

For instance, you want to stay clear of the methods defined on the right-hand site of this page: http://www.phpactiverecord.org/docs/ActiveRecord/Model .
You also got to remember that you'd have some magic with getters and setters: If you wanted a method that gets some random information from your database and you would call it

get_myInfo()

you might be getting in trouble because of this: http://www.phpactiverecord.org/projects/main/wiki/Utilities#attribute-getters

Ben Oberholzer Fri Jun 10 11:08:11 -0400 2011

Yeah, it seems like I'm still going to need some outside classes. I am aware of the getter/setter stuff.

(1-2/2)