public function actionAcceptReceivedSchedule($id) { $scheduleNotify = ScheduleNotification::findOne(['id' => $id]); $schedule = Schedule::findOne(['id' => $scheduleNotify['schedule_id']]); $newSchedule = new Schedule(); $newSchedule['title'] = $schedule['title']; $newSchedule['color'] = $schedule['color']; $newSchedule['start'] = $schedule['start']; $newSchedule['end'] = $schedule['end']; $newSchedule['create_at'] = $schedule['create_at']; $newSchedule['own_id'] = \Yii::$app->user->getId(); $newSchedule->save(); ScheduleNotification::deleteAll(['id' => $id]); $this->redirect('?r=schedule/create-event'); }