title: Passing models in array format to views in YII
body: <p>How can I pass the model in array format.
  I want to pass models in this format from controller to view:-</p>
  
  <p>Users[user_contact]=Contact
  Users[user_contact][contat_city]=City
  Users[user_contact][contact_state]=state</p>
  
  <p>This is what I am doing</p>
  
  <pre><code>public function actionCreate() {
      $user = new Users;
      $presContact = new Contacts;
      $presCity = new Cities;
      $presState = new States;
      $contactArr = array();
      // Uncomment the following line if AJAX validation is needed
      // $this-&gt;performAjaxValidation($model);
      if (isset($_POST['Users'])) {
          $transaction = CActiveRecord::getDBConnection()-&gt;beginTransaction();
          $contactArr = CommonFunctions::saveContact($_POST['Users']['user_pres_contact'],'user_pres_contact',$errorArr);
          $presContact = $contactArr['contact'];
          $presCity = $contactArr['city'];
          $presState = $contactArr['state'];
          $user-&gt;attributes = $_POST['Users'];
          $user-&gt;user_pres_contact_id = $presContact-&gt;contact_id;
          if($user-&gt;save()){
              $transaction-&gt;commit();
              $this-&gt;redirect(array('view', 'id' =&gt; $user-&gt;user_id));
          } else {
              $transaction-&gt;rollback();
  
          }
      }
  
      $this-&gt;render('createUser', array(
          'Users' =&gt; $user,
          'Users[\'user_pres_contact\']'=&gt;$presContact,
          'Users[\'user_pres_contact\'][\'contact_city\']'=&gt;$presCity,
          'Users[\'user_pres_contact\'][\'contact_state\']'=&gt;$presState,
      ));
  }
  </code></pre>
  
  <p>I am able to access only $users but
  I m not able to access $Users['user_pres_contact'] in the view</p>