public function actionCreate()
{
$model=new events;
if(isset($_POST['events']))
{
$model->event_title = $_POST['events']['event_title'];
$model->event_description = $_POST['events']['event_description'];
$model->event_repeat_option = $_POST['events']['event_repeat_option'];
$model->event_start_date = date('Y-m-d H:i:s');
$model->event_end_date = date('Y-m-d H:i:s');
$model->user_id = yii::app()->user->getState('user_id');
$model->deal_id = "1";
$model->event_type = "1";
$model->event_creation_date = date('Y-m-d H:i:s');
if($model->save())
$this->redirect(array('view','id'=>$model->event_id));
}
}
複数のレコードを挿入しますか? なんで?バグもエラーもありません...データは完全に挿入されています...しかし、一度に複数のレコード。
Print_r($model->attributes); を実行しました。
Array
(
[event_status] => 1
[event_title] => test1
[event_description] => test1
[event_repeat_option] => test1
[event_start_date] => 2012-05-15 18:45:40
[event_end_date] => 2012-05-15 18:45:40
[user_id] => 3
[deal_id] => 1
[event_type] => 1
[event_creation_date] => 2012-05-15 18:45:40
[event_id] =>
)
...すべて問題ありませんが、まだいくつかのバグがあります...追跡できません。なにか提案を?
モデル属性
/**
* This is the model class for table "user_events".
*
* The followings are the available columns in table 'user_events':
* @property integer $event_id
* @property integer $user_id
* @property string $event_type
* @property integer $deal_id
* @property string $event_creation_date
* @property string $event_start_date
* @property string $event_end_date
* @property string $event_title
* @property string $event_description
* @property integer $event_repeat_option
* *
* The followings are the available model relations:
* @property Deals $deal
* @property RepeatOptions $eventRepeatOption
* @property Users $user */