コード例 #1
0
ファイル: AuthorController.php プロジェクト: yasoon/yasoon
 /**
  * @Route("/saveQuestionAnswer")
  * @Method({"POST"})
  *
  * @return array
  */
 public function saveQuestionAnswer(Request $request)
 {
     $req_array = $request->request->all();
     /*$result = [];
       
       $method = $request->getMethod();
       switch($method)
       {
           case 'DELETE' :
               $array = $request->request->all();
               if($array['type'] == 'delete')
               {
                   $result = $this->service->deleteQuestion($array['id']);
               }
           break;
           case 'PUT' :
               $array = $request->request->all();
               $result = $this->service->answerQuestion($array);
           break;
       }
       */
     //$req_array = ['type' => 'answer', 'id' => 54, 'authorId' => 91, 'questionAnswerText' => 'fdfdfd'];
     if ($req_array['type'] == 'answer') {
         $result = $this->service->answerQuestion($req_array);
     }
     if ($req_array['type'] == 'delete') {
         $result = $this->service->deleteQuestion($req_array['id']);
     }
     return $result;
 }