我有这个代码片段。我想将数据从一个表复制到另一个..请看我的代码,这不起作用。
谢谢
protected function afterSave()
//Copy data from Client to packageassignment ***
// assuming your you're in the Client model
//and Client has id,package_id,p_start_date
{
$packageassignment= new Packageassignment();
$packageassignment->user_id=$this->id;
$packageassignment->package_id=$this->package_id;
$packageassignment->package_start_date=$this->p_start_date;
$packageassignment->save();
return parent::afterSave();
}