I am getting this error 'Calling unknown method: yiiconsoleApplication::getSession()' when i run a console app that updates an AR that has a BlameableBehavior.
TIA.
That's expected since there's no session in console.
@samdark does it mean i cannot update that AR via a console app? thanks!
i mean i can't use BlameableBehavior then, right? thanks!
you have to set the user attribute of the behavior yourself because yii can not detect the current user from Yii::$app->user there.
any way i can detect if it is from console app? thanks.
you can check Yii::$app instanceof \yii\console\Application
saves my day. thanks much @cebe @samdark
saves my day. thanks much @cebe @samdark
How did you solve the problem? Would you mind to share here your solution?
Most helpful comment
you can check
Yii::$app instanceof \yii\console\Application