public function actionUpdateDirections()
 {
     $directionsArray = Yii::$app->request->post('directions');
     $currentPsychologistId = Yii::$app->user->id;
     $psychologistDirections = new PsychologistDirections();
     if ($psychologistDirections->setNewPsychologistDirections($currentPsychologistId, $directionsArray)) {
         return $this->redirect('index');
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 private function deletePsychologistDirections($psychologistId)
 {
     return PsychologistDirections::deleteAll('psychologist_id = ' . $psychologistId);
 }
Example #3
0
 /**
  * Deletes an existing Directions model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     PsychologistDirections::deleteAll(['direction_id' => $id]);
     return $this->redirect(['index']);
 }