title: RateLimiter: 'yii\base\UnknownPropertyException' after deployment in production
body: <p>For authorized users I set limit for the frequency of queries to the system. If the number of requests per given time interval more than set, it returns a response with status code <code>429</code>. In my particular case it is no more than one request in five seconds.</p>
  
  <p>In identity class I implemented the <code>yii\filters\RateLimitInterface</code>:</p>
  
  <pre><code>&lt;?php
  namespace common\models;
  
  use yii\db\ActiveRecord;
  use yii\web\IdentityInterface;
  use yii\filters\RateLimitInterface;
  
  /**
   * User model
   *
   * ...
   * @property integer $id
   * ...
   *
   * @property integer $allowance
   * @property integer $allowance_updated_at
    */
  class User extends ActiveRecord implements IdentityInterface, RateLimitInterface
  {
      ...
  
      /**
       * @inheritdoc
       */
      public static function tableName()
      {
          return '{{%user}}';
      }
  
      /**
       * Returns the maximum number of allowed requests and the window size.
       * @param \yii\web\Request $request the current request
       * @param \yii\base\Action $action the action to be executed
       * @return array an array of two elements. The first element is the maximum number of allowed requests,
       * and the second element is the size of the window in seconds.
       */
      public function getRateLimit($request, $action)
      {
          return [1, 5];
      }
  
      /**
       * Loads the number of allowed requests and the corresponding timestamp from a persistent storage.
       * @param \yii\web\Request $request the current request
       * @param \yii\base\Action $action the action to be executed
       * @return array an array of two elements. The first element is the number of allowed requests,
       * and the second element is the corresponding UNIX timestamp.
       */
      public function loadAllowance($request, $action)
      {
          return [$this-&gt;allowance, $this-&gt;allowance_updated_at];
      }
  
      /**
       * Saves the number of allowed requests and the corresponding timestamp to a persistent storage.
       * @param \yii\web\Request $request the current request
       * @param \yii\base\Action $action the action to be executed
       * @param integer $allowance the number of allowed requests remaining.
       * @param integer $timestamp the current timestamp.
       */
      public function saveAllowance($request, $action, $allowance, $timestamp)
      {
          $this-&gt;allowance = $allowance;
          $this-&gt;allowance_updated_at = $timestamp;
          $this-&gt;save();
      }
      ...
  }
  </code></pre>
  
  <p>In the behaviours I added the following:</p>
  
  <pre><code>'rateLimiter' =&gt; [
      'class' =&gt; RateLimiter::className(),
  ]
  </code></pre>
  
  <p>To the table <code>tbl_user</code> I added two fields:</p>
  
  <pre><code>[allowance] [int] NULL
  [allowance_updated_at] [int] NULL
  </code></pre>
  
  <p>In the local environment all works fine and if the user made more than one request in 5 seconds, he will see the exception <code>yii\web\TooManyRequestsHttpException</code> and this page:</p>
  
  <p><a href="https://i.stack.imgur.com/OBzAr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OBzAr.jpg" alt="enter image description here"></a></p>
  
  <p>Ok.. Next, I created two migration files and applied them on the test server and on the production server:</p>
  
  <pre><code>...
  yii migrate/create add_allowance_column_to_tbl_user --fields=allowance:integer
  yii migrate/create add_allowance_updated_at_column_to_tbl_user --fields=allowance_updated_at:integer
  
  yii migrate
  ...
  </code></pre>
  
  <p>Migration files:</p>
  
  <pre><code>&lt;?php
  
  use yii\db\Migration;
  
  class m160722_073856_add_allowance_column_to_tbl_user extends Migration
  {
      public function up()
      {
          $this-&gt;addColumn('tbl_user', 'allowance', $this-&gt;integer());
      }
  
      public function down()
      {
          $this-&gt;dropColumn('tbl_user', 'allowance');
      }
  }
  
  ...
  
  &lt;?php
  
  use yii\db\Migration;
  
  class m160722_073932_add_allowance_updated_at_column_to_tbl_user extends Migration
  {
      public function up()
      {
          $this-&gt;addColumn('tbl_user', 'allowance_updated_at', $this-&gt;integer());
      }
  
      public function down()
      {
          $this-&gt;dropColumn('tbl_user', 'allowance_updated_at');
      }
  }
  </code></pre>
  
  <p>On the test server everything works perfectly.</p>
  
  <p>Next, I moved the solution to the production server and have a problem:</p>
  
  <pre><code>2016-07-22 12:17:37 [10.1.80.59][25112][snadvdlp3cb15fs9kc0j3dk5c3][error][yii\base\UnknownPropertyException] exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: common\models\User::allowance' in D:\wwwroot\aisnew\vendor\yiisoft\yii2\base\Component.php:143
  Stack trace:
  #0 D:\wwwroot\aisnew\vendor\yiisoft\yii2\db\BaseActiveRecord.php(247): yii\base\Component-&gt;__get('allowance')
  #1 D:\wwwroot\aisnew\common\models\User.php(388): yii\db\BaseActiveRecord-&gt;__get('allowance')
  #2 D:\wwwroot\aisnew\vendor\yiisoft\yii2\filters\RateLimiter.php(100): common\models\User-&gt;loadAllowance(Object(yii\web\Request), Object(yii\base\InlineAction))
  #3 D:\wwwroot\aisnew\vendor\yiisoft\yii2\filters\RateLimiter.php(78): yii\filters\RateLimiter-&gt;checkRateLimit(Object(common\models\User), Object(yii\web\Request), Object(yii\web\Response), Object(yii\base\InlineAction))
  #4 D:\wwwroot\aisnew\vendor\yiisoft\yii2\base\ActionFilter.php(70): yii\filters\RateLimiter-&gt;beforeAction(Object(yii\base\InlineAction))
  #5 [internal function]: yii\base\ActionFilter-&gt;beforeFilter(Object(yii\base\ActionEvent))
  #6 D:\wwwroot\aisnew\vendor\yiisoft\yii2\base\Component.php(541): call_user_func(Array, Object(yii\base\ActionEvent))
  #7 D:\wwwroot\aisnew\vendor\yiisoft\yii2\base\Controller.php(269): yii\base\Component-&gt;trigger('beforeAction', Object(yii\base\ActionEvent))
  #8 D:\wwwroot\aisnew\vendor\yiisoft\yii2\web\Controller.php(121): yii\base\Controller-&gt;beforeAction(Object(yii\base\InlineAction))
  #9 D:\wwwroot\aisnew\common\components\AisUniversityController.php(22): yii\web\Controller-&gt;beforeAction(Object(yii\base\InlineAction))
  #10 D:\wwwroot\aisnew\vendor\yiisoft\yii2\base\Controller.php(152): common\components\AisUniversityController-&gt;beforeAction(Object(yii\base\InlineAction))
  #11 D:\wwwroot\aisnew\vendor\yiisoft\yii2\base\Module.php(454): yii\base\Controller-&gt;runAction('readyoperator', Array)
  #12 D:\wwwroot\aisnew\vendor\yiisoft\yii2\web\Application.php(84): yii\base\Module-&gt;runAction('queue/queue/rea...', Array)
  #13 D:\wwwroot\aisnew\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application-&gt;handleRequest(Object(yii\web\Request))
  #14 D:\wwwroot\aisnew\backend\web\index.php(18): yii\base\Application-&gt;run()
  </code></pre>
  
  <p>I switch the local/ test environment to the industrial database and everything works..</p>
  
  <p>What can be the reason?</p>