Hi!
I have a small problem here and I'm not sure how to handle it.
I have an Active Record model class callsed User. The db table has an attribute "active". Therefore, you can access a property in User class like $User->active.
What I'd like to do now is to disable or disallow direct property access. In normal circumstances I'd define $active property as private but since Yii doesn't work that way - I can't. If I define it as private, it doesn't get set when I load object properties via i.e. findByPK().
The bottom line is - how can I enforce accessing this kind of property only through getters and setters and not directly?
Any suggestions?
Thanx.
I have a small problem here and I'm not sure how to handle it.
I have an Active Record model class callsed User. The db table has an attribute "active". Therefore, you can access a property in User class like $User->active.
What I'd like to do now is to disable or disallow direct property access. In normal circumstances I'd define $active property as private but since Yii doesn't work that way - I can't. If I define it as private, it doesn't get set when I load object properties via i.e. findByPK().
The bottom line is - how can I enforce accessing this kind of property only through getters and setters and not directly?
Any suggestions?
Thanx.