public function __construct($scenario = '', $id = null, $checkApproved = false)
 {
     if ($scenario == 'view' && $id != null) {
         $this->workshopPlanned = WorkshopPlanned::model()->with('postItem')->findByPk($id);
         if ($this->workshopPlanned != null) {
             $this->postItem = $this->workshopPlanned->postItem;
         } else {
             throw new CHttpException(400, 'Cannot find the planned workshop.');
         }
     } else {
         $this->_new();
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = WorkshopPlanned::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }