We read the group of conditions by default look here
And here is your performance:
Add a field to the class MyClass:
class MyClass extends CActiveRecord { public ip_addr; // далее ваш код //Также атрибут необходимо зделать несохраняемым в базу public function rules() { //ваш код array ( 'ip_addr','unSafe') } //группа условий по умолчанию public function defaultScope() { return array( 'select '=>" *, INET_NTOA(ip_addr) AS ip_addr", ); } }
If the value of the field ip_addr comes from the field from the User, then it should not be done not saved. But then the question is - how do you convert it before saving? And another line
'select '=>" *, INET_NTOA(ip_addr) AS ip_addr",
nada will rewrite it like this
'select '=>"перечисляем все поля таблицы за исключением ip_addr, INET_NTOA(ip_addr) AS ip_addr"