title: Any Yii Validation Pattern on - How to allow insert with required fields missing?
body: <p>This may seem weird at a first sight. </p>
  
  <p>We wish to allow the user to SAVE INTO DATABASE, even if, some required fields are missing.</p>
  
  <p>Then, when the user wishes to PUBLISH those records, it should NOT be allowed, because those required fields are missing.</p>
  
  <p>Perhaps, create some sort of required variation that tell us:
  Required for PUBLISHING but not for INSERTING;</p>
  
  <p>Taking into consideration your Yii knowledge, is there some sort of pattern we should use on this case?</p>
  
  <h2>UPDATE</h2>
  
  <p>Scenarios seems to be a nice approach, but the documentation suggests adding:</p>
  
  <pre><code>$model = new MyActiveRecord('Inserting');
  </code></pre>
  
  <p>On our controller.</p>
  
  <p>On my controller, I have, however, this:</p>
  
  <pre><code>public function actionCreate()
  {
    $this-&gt;layout = 'admin';
  
    $model=new HsGuestbook;
  
    $localized[] = $this-&gt;getExtraModelGuestTr();
  
    if(isset($_POST['HsGuestbook']))
    {
     ...
  </code></pre>
  
  <p>So, I've tried to do:</p>
  
  <pre><code>  if(isset($_POST['HsGuestbook']))
    {
       //check validation scenarios
       if ($model-&gt;status === 0) { //if publish isn't set:
            $model-&gt;setScenario('Insert'); 
       } elseif ($model-&gt;status === 1){
             $model-&gt;setScenario('Publish'); 
       }
  </code></pre>
  
  <p>And on my model:</p>
  
  <pre><code>public function rules()
  {
      return array(
           array('name, category', 'required', 'on'=&gt;'Insert'),
           array('name, category, image', 'required', 'on'=&gt;'Publish'))
  </code></pre>
  
  <p>I got no validations displayed. </p>