In my old project I used long id for table primary key, like 'shop_id' or 'order_id', but now I want to use just 'id' as alias for 'shop_id'. How to add this to the model class only, not changing tables. After that I'd like to have something like this
$model->id = $var
or
$var = $model->id
and
$var = $model->attributes['id'].
Simply create a getter method in your model code like this:
If you have this on many tables, you could extend CActiveRecord and add a getter to that class like this: