示例#1
0
 public function getReminder()
 {
     $reminder = CalendarReminder::findOne(['event_id' => $this->id, 'created_by' => \yii::$app->user->id]);
     if (!$reminder) {
         $reminder = new CalendarReminder();
     } else {
         $reminder->active = true;
     }
     return $reminder;
 }
 public function actionDelete()
 {
     self::validateRequest();
     $id = Yii::$app->request->post('CalendarEvent')['id'];
     $model = CalendarEvent::findOne($id);
     if (!$model || !$model->isMine()) {
         return false;
     }
     //Elimina assigned
     CalendarEventAssign::deleteAll(['calendar_event_id' => $id]);
     //Elimina reminders
     CalendarReminder::findAll(['event_id' => $id]);
     //Elimina evento
     CalendarReminder::deleteAll(['event_id' => $id]);
     return $model->delete();
 }