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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.