Hey,
i like to modify the data after loading them from datastore (here: elastic search) using ActiveRecord.
The modification depends on some attributes of the model: $model::$counter. My data model ($model) extends \yii\[..your db engine..]\ActiveRecord
So it looks like, there are 2 ways:
1.) overwriting the afterFind method coming from ActiveRecord. The problem is, that attributes from my data-model ($model), like $model->counter are ignored by afterFind()
. They need to be static attributes, like $model::$counter
2.) Defining an Behaviors, like explained here: Key Concepts: Behaviors | The Definitive Guide to Yii 2.0 | Yii PHP Framework
What is the “right” way / place for modifying data after find?
Does Behaviors support afertFind to work with non-static attributes, like $model->counter =1 ?
Thank you