title: Yii2 active record model not saving data
body: <p>I've built a simple form model &amp; view, a simple AR model, and a simple controller. The form model assigns the correct values to the AR instance, but when I call save(), none of those values are saved in the DB. Any ideas?</p>
  
  <p>The form model:</p>
  
  <pre><code>&lt;?php
  
  namespace app\models;
  
  use Yii;
  use yii\base\Model;
  
  class PromptForm extends Model
  {
      public $name;
      public $intro;
      public $prompt;
      public $notes;
      public $questions;
  
  
      public function attributeLabels()
      {
          return [
              'name' =&gt; 'Prompt title',
              'intro' =&gt; 'Intro',
              'prompt' =&gt; 'Prompt body',
              'notes' =&gt; 'Closing notes',
              'questions' =&gt; 'Exploration questions',
          ];
      }
  
      /**
       * @return array the validation rules.
       */
      public function rules()
      {
          return [
              [['name', 'prompt'], 'required'],
              ['name', 'filter', 'filter' =&gt; 'trim'],
              ['name', 'string', 'max' =&gt; 255],
              [['intro', 'prompt', 'notes', 'questions'], 'default'],
          ];
      }
  
      public function post()
      {
          if ($this-&gt;validate()) {
              $prompt = new Prompt();
              $prompt-&gt;name = $this-&gt;name;
              $prompt-&gt;intro = $this-&gt;intro;
              $prompt-&gt;prompt = $this-&gt;prompt;
              $prompt-&gt;notes = $this-&gt;notes;
              $prompt-&gt;questions = $this-&gt;questions;
  
              $prompt-&gt;author = \Yii::$app-&gt;user-&gt;getId();
  
              //die(print_r($prompt, TRUE));
  
              $prompt-&gt;save();
  
              return $prompt;
          }
  
          return null;
      }
  }
  </code></pre>
  
  <p>The AR model:</p>
  
  <pre><code>&lt;?php
  
  namespace app\models;
  
  use Yii;
  use yii\db\ActiveRecord;
  
  /**
   * Prompt is the model behind the prompt item.
   */
  class Prompt extends ActiveRecord
  {
      public $name;
      public $intro;
      public $prompt;
      public $notes;
      public $questions;
      public $status;
      public $author;
  
      public $id;
  
      /**
       * @return string the name of the table associated with this ActiveRecord class.
       */
      public static function tableName()
      {
          return 'prompt';
      }
  
      /**
       * @return array the attribute labels.
       */
      public function attributeLabels()
      {
          return [
              'name' =&gt; 'Prompt title',
              'intro' =&gt; 'Intro',
              'prompt' =&gt; 'Prompt body',
              'notes' =&gt; 'Closing notes',
              'questions' =&gt; 'Exploration questions',
              'status' =&gt; 'Status',
              'author' =&gt; 'Author ID',
          ];
      }
  }
  </code></pre>
  
  <p>The controller:</p>
  
  <pre><code>&lt;?php
  
  namespace app\controllers;
  
  use Yii;
  use yii\filters\AccessControl;
  use yii\web\Controller;
  use yii\filters\VerbFilter;
  use app\models\PromptForm;
  use app\models\Prompt;
  
  class PromptsController extends Controller
  {
      public function actionIndex()
      {
          // Return a list of all prompts:
          return $this-&gt;render('index');
      }
  
      public function actionNew()
      {
          if (\Yii::$app-&gt;user-&gt;isGuest) {
              return $this-&gt;goHome();
          }
  
          $model = new PromptForm();
          if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
              if ($prompt = $model-&gt;post()) {
                  Yii::$app-&gt;getSession()-&gt;setFlash('success', 'Your prompt was created successfully!');
                  return $this-&gt;goHome();
              } else {
                  Yii::$app-&gt;getSession()-&gt;setFlash('error', 'Error while submitting your prompt.');
              }
          }
  
          return $this-&gt;render('create', [
              'model' =&gt; $model,
          ]);
      }
  }
  </code></pre>