title: Can't create object in the controller Yii2
body: <p>I am trying to create on instace of <code>ProductReview</code> which has CRUD and model and database tabel but i get an empty object. I tried whit other models but they all work as expected. Can you give an advance ?
  This is what i got in controller:</p>
  
  <pre><code>$review = new ProductReview();
          var_dump($review);die;
  </code></pre>
  
  <p>wich returns:</p>
  
  <pre><code>object(backend\modules\products\models\ProductReview)#322 (8) { ["_attributes":"yii\db\BaseActiveRecord":private]=&gt; array(0) { } ["_oldAttributes":"yii\db\BaseActiveRecord":private]=&gt; NULL ["_related":"yii\db\BaseActiveRecord":private]=&gt; array(0) { } ["_errors":"yii\base\Model":private]=&gt; NULL ["_validators":"yii\base\Model":private]=&gt; NULL ["_scenario":"yii\base\Model":private]=&gt; string(7) "default" ["_events":"yii\base\Component":private]=&gt; array(0) { } ["_behaviors":"yii\base\Component":private]=&gt; array(0) { } }
  </code></pre>
  
  <p>And because of that i get an error in my <code>ActiveForm</code> which is:</p>
  
  <pre><code>Call to a member function isAttributeRequired() on string
  </code></pre>
  
  <p>Why is that happens and why is it happens only with <code>ProductReview</code>? Do you guys have a clue?Thank you!</p>
  
  <p><strong>EDIT</strong>
  Model:</p>
  
  <pre><code> &lt;?php
  namespace backend\modules\products\models;
  
  use Yii;
  use backend\modules\products\models\Product;
  
  /**
   * This is the model class for table "product_review".
   *
   * @property integer $id
   * @property integer $product_id
   * @property integer $user_id
   * @property integer $active
   * @property string $language
   * @property string $names
   * @property string $email
   * @property string $title
   * @property string $review
   * @property integer $rating
   * @property string $dt
   */
  class ProductReview extends \yii\db\ActiveRecord
  {
      /**
       * @inheritdoc
       */
      public static function tableName()
      {
          return 'product_review';
      }
  
      /**
       * @inheritdoc
       */
      public function rules()
      {
          return [
              [['product_id', 'language', 'names', 'review', 'rating'], 'required'],
              [['product_id', 'user_id', 'active', 'rating', 'is_home', 'status'], 'integer'],
              [['review'], 'string'],
              [['dt'], 'safe'],
              [['language'], 'string', 'max' =&gt; 10],
              [['names', 'title'], 'string', 'max' =&gt; 255],
              [['email'], 'string', 'max' =&gt; 100],
          ];
      }
  
      /**
       * @inheritdoc
       */
      public function attributeLabels()
      {
          return [
              'id' =&gt; Yii::t('app', 'ID'),
              'product_id' =&gt; Yii::t('app', 'Product'),
              'user_id' =&gt; Yii::t('app', 'Customer'),
              'active' =&gt; Yii::t('app', 'Active'),
              'language' =&gt; Yii::t('app', 'Language'),
              'names' =&gt; Yii::t('app', 'Names'),
              'email' =&gt; Yii::t('app', 'Email'),
              'title' =&gt; Yii::t('app', 'Title'),
              'review' =&gt; Yii::t('app', 'Review'),
              'rating' =&gt; Yii::t('app', 'Rating'),
              'dt' =&gt; Yii::t('app', 'Date'),
              'is_home' =&gt; Yii::t('app', 'home'),
          ];
      }
  
      public function getUser()
      {
          return $this-&gt;hasOne(User::className(), ['id' =&gt; 'user_id']);
      }
  
      public function getProduct()
      {
          return $this-&gt;hasOne(Product::className(), ['id' =&gt; 'product_id']);
      }
  
      public function changeActiveForm() {
          $active = "";
          if ($this-&gt;active == 1) {
              $active = 'checked="checked"';
          }
          return '&lt;label class="switchery switchery-default taCenter"&gt;
                  &lt;input type="checkbox" class="js-switch" data-color="#99d683" data-secondary-color="#f96262" value="1" id="check_' . $this-&gt;id . '" name="field_types" class="legend-switch" ' . $active . ' onchange="changeStatusActive(' . $this-&gt;id . ', \'product-review\');"&gt;&lt;/input&gt;
                  &lt;label data-off="'.Yii::t('app', 'Не').'" data-on="'.Yii::t('app', 'Да').'" for="check_' . $this-&gt;id . '"&gt;&lt;/label&gt;
                  &lt;span&gt;&lt;/span&gt;
              &lt;/label&gt;';
      }
  
      public function changeHome() {
          $active = "";
          if ($this-&gt;is_home == 1) {
              $active = 'checked="checked"';
          }
          return '&lt;label class="switchery switchery-default taCenter"&gt;
                  &lt;input type="checkbox" class="js-switch" data-color="#99d683" data-secondary-color="#f96262" value="1" id="checkH_' . $this-&gt;id . '" name="field_types" class="legend-switch" ' . $active . ' onchange="changeHome(' . $this-&gt;id . ', \'product-review\');"&gt;&lt;/input&gt;
                  &lt;label data-off="'.Yii::t('app', 'Не').'" data-on="'.Yii::t('app', 'Да').'" for="checkH_' . $this-&gt;id . '"&gt;&lt;/label&gt;
                  &lt;span&gt;&lt;/span&gt;
              &lt;/label&gt;';
      }
  
      public function changeStatus() {
          $active = "";
          if ($this-&gt;status == 1) {
              $active = 'checked="checked"';
          }
          return '&lt;label class="switchery switchery-default taCenter"&gt;
                  &lt;input type="checkbox" class="js-switch" data-color="#99d683" data-secondary-color="#f96262" value="1" id="checkS_' . $this-&gt;id . '" name="field_types" class="legend-switch" ' . $active . ' onchange="changeStatus(' . $this-&gt;id . ', \'product-review\');"&gt;&lt;/input&gt;
                  &lt;label data-off="'.Yii::t('app', 'Не').'" data-on="'.Yii::t('app', 'Да').'" for="checkS_' . $this-&gt;id . '"&gt;&lt;/label&gt;
                  &lt;span&gt;&lt;/span&gt;
              &lt;/label&gt;';
      }
  
      public function getUserList() { // could be a static func as well
          $users = User::find()-&gt;all();
          $arrayUsers = array();
          if($users){
              foreach($users as $user){
                  $arrayUsers[$user-&gt;id] = $user-&gt;username;
              }
          }
          return $arrayUsers;
      }
  
      public function getProductList() { // could be a static func as well
          $products = Product::find()-&gt;all();
          $arrayProducts = array();
          if($products){
              foreach($products as $product){
                  $arrayProducts[$product-&gt;id] = $product-&gt;title;
              }
          }
          return $arrayProducts;
      }
  
      public function showRating() {
          $rating = $this-&gt;rating;
          $ratingHTML = '';
          $ratingHTML .= '&lt;ul class="ratingList"&gt;';
          $ratingHTML .= ($rating &gt;= 1) ? '&lt;li class="active"&gt;': '&lt;li&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star-o empty tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star active tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;/li&gt;';
          $ratingHTML .= ($rating &gt;= 2) ? '&lt;li class="active"&gt;': '&lt;li&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star-o empty tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star active tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;/li&gt;';
          $ratingHTML .= ($rating &gt;= 3) ? '&lt;li class="active"&gt;': '&lt;li&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star-o empty tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star active tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;/li&gt;';
          $ratingHTML .= ($rating &gt;= 4) ? '&lt;li class="active"&gt;': '&lt;li&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star-o empty tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star active tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;/li&gt;';
          $ratingHTML .= ($rating &gt;= 5) ? '&lt;li class="active"&gt;': '&lt;li&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star-o empty tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;i class="fa fa-star active tr_all_hover"&gt;&lt;/i&gt;';
          $ratingHTML .= '&lt;/li&gt;';
          return $ratingHTML;
      }
  }
  </code></pre>