codeigniter-base-model
codeigniter-base-model copied to clipboard
Implement property overloading
This will allow outside classes to be able to read properties of the MY_Model class when necessary.
Could you show an example of where this might be useful?
@jamierumbelow I just thought it would be useful for when you have have other models that aren't based on MY_Model, and don't wish to make them children of MY_Model for whatever reason. So you could do $this->my_model_child->primary_key.
In my case, I have an application that I began before I discovered MY_Model, and don't wish to convert all the older models.
Rather than using __get() - your implementation is wrong anyway, since you're just returning the property name as a string value - wouldn't it be better to just convert over the protected and private properties to public?
Ooops, I didn't even realize I implemented it improperly.