tatebn Posted February 2, 2011 Share Posted February 2, 2011 I have a class that has the __get and __set magic methods defined. The idea is to use those to communicate with the __get and __set methods in a database table object which is a protected attribute of this class. Then I can quickly build out models without having to bother with method definitions aside from those that need modifications made to the data before saving. The problem is, they don't seem to be doing anything. I get an undefined function error the first time I call getVarx(). I don't actually have any of the attributes I'm trying to get and set defined in the object, but I thought that was the point of these magic methods. Am I missing something here? Thanks, Brandon Link to comment https://forums.phpfreaks.com/topic/226466-problem-with-magic-methods/ Share on other sites More sharing options...
tatebn Posted February 2, 2011 Author Share Posted February 2, 2011 Figured it out. I didn't understand what __get did. It's for $object->property, not for actual getProperty() methods. Need to use __call for that. Link to comment https://forums.phpfreaks.com/topic/226466-problem-with-magic-methods/#findComment-1169080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.