Hello Guys,
I have this query:
$data = Category::find()
->with(['products' => function($q) {
$q->select(['id', 'desc', 'category_id']);
}])
->select(['id', 'desc'])
->asArray()
->all();
And this behavior:
'userId' => [
'class' => AttributeBehavior::className(),
'attributes' => [
ActiveRecord::EVENT_AFTER_FIND => 'user_id',
],
'value' => function ($event) {
if ($this->user_id !== Yii::$app->user->id) {
throw new \Exception('user_id');
}
},
],
But it seens that my query is not triggering this event.
Am I doing anything wrong?
Thanks!