title: Yii2 Rest api put method return Internal Server Error - Failed to update the object for unknown reason
body: <p>I am creating an API in yii2, all methods are working fine beside of <code>put</code> method. I am getting data in <code>before_save</code> method but getting below error when it save.</p>
  
  <blockquote>
    <p>{   "name": "Internal Server Error",   "message": "Failed to update
    the object for unknown reason.",   "code": 0,   "status": 500,<br>
    "type": "yii\web\ServerErrorHttpException" }</p>
  </blockquote>
  
  <p>here is my controller file</p>
  
  <p>ProductsController.php</p>
  
  <pre><code>&lt;?php
  
  namespace app\controllers;
  
  use yii\rest\ActiveController;
  use yii\filters\auth\HttpBearerAuth;
  
  
  class ProductsController extends ActiveController {
  
      public $modelClass = 'app\models\Product';
  
      public function __construct($id, $module, $config = array()) {
  
          parent::__construct($id, $module, $config);
      }
  
  
      public function behaviors() {
          $behaviors = parent::behaviors();
  
          $behaviors['authenticator'] = [
              'class' =&gt; HttpBearerAuth::className(),
          ];
  
          return $behaviors;
      }
  
  }
  </code></pre>
  
  <p>Here is model file
  Product.php</p>
  
  <pre><code>&lt;?php
  
  namespace app\models;
  
  use yii\db\ActiveRecord;
  use yii;
  
  class Product extends ActiveRecord {
  
      public static function tableName() {
          return '{{%o2o_products}}';
      }
  
      public function rules() {
          return [
              [['name'], 'required'],
          ];
      }
  }
  </code></pre>
  
  <p>And this is my web.php</p>
  
  <pre><code>'urlManager' =&gt; [
              'enablePrettyUrl' =&gt; true,
              'enableStrictParsing' =&gt; false,
              'showScriptName' =&gt; false,
              'rules' =&gt; [
                  '&lt;alias:index|about|contact|login&gt;' =&gt; 'site/&lt;alias&gt;',
                  ['class' =&gt; 'yii\rest\UrlRule', 'controller' =&gt; 'user'],
                  ['class' =&gt; 'yii\rest\UrlRule', 'controller' =&gt; 'products'],
                  ['class' =&gt; 'yii\rest\UrlRule', 'controller' =&gt; 'orders'],
  
              ],
          ]
  </code></pre>
  
  <p>I tried with removing <code>rule</code> with on create and on update statements. but no success.</p>
  
  <p>Let me know if you need any thing else.</p>