title: Yii2 enforce 404 or 500 error
body: <p>In my controller's action of Yii2 application suppose the following:</p>
  
  <pre><code>public function actionView($i)
  {
    if ($i &lt; 20)
    {
      //I want execute error 404
    }
  }
  </code></pre>
  
  <p>All what I can to do now is just setting a flash message and redirect to another action. However, I want to generate 404 Page not found response.</p>