You may have some variables that will be reused, that aren’t a single database field. For example, a rating that is determined by querying some rows. Or perhaps some strings that are always combined, such as the page URL or someone’s location.

Using __get and __set methods in your models allows you to create a function that will act like a class property (member variable). If you create a method in your model named getRating, which returns a value, you can then access it via $model->rating.

Posted in: Yii

Related FAQ's

Marius Ion ANGEL HOT SOFT LLC (800) 316-7677