I am writing an app that runs from the browser. However, some model functions are also called from the Yii2 console. Therefore, I am getting errors when trying to access variabl
There is a simpler way to figure this out without going through the Yii objects
Yii
if (php_sapi_name() == "cli") { return; }
...and it works for all PHP scripts ...and it is lighter