Just curious if it’s okay to add some custom fields to a model, fields that have nothing to deal with the database.
The problem is that I have to add a dropdown list to a view which has to have a data array from another model. For example I’ve got two model which are Client and Registration. The Registration model has all the license keys that’s been currently using by users. I need to do something like this in the Client model:
class Client extends \yii\db\ActiveRecord
public $all_license_key = Registration::find()->select([‘license_key’])->indexBy(‘id’)->column();
To me it feels like there’s gotta be a better way to do this. Maybe using behaviors or something would be more appropriate