original_string: public function updateAction(Request $request)
          {
  
              try {
                  $id = $this->getUser()->getId();
  
                  /** @var User $oUser */
                  $oUser = UserQuery::create()->findOneById($id);
  
                  if ($oUser === null) {
                      throw $this->createNotFoundException('Unable to find User entity.');
                  }
  
                  $aPost = $request->request->get("form");
  
  
                  $nbUpdatedRows = UserQuery::create()
                      ->filterById($id)
                      ->update(array('NotificationError' => isset($aPost['notification_error']), 'NotificationChange' => isset($aPost['notification_change'])));
  
  
                  $aResult = array(
                      "success" => true,
                      "message" => $this->get("translator")->trans("notificationcenter.save.successful")
                  );
  
              } catch (\Exception $e) {
                  $aResult = array(
                      "success" => false,
                      "message" => $this->get("translator")->trans("notificationcenter.save.failed") . ":<br>" . $e->getMessage()
                  );
              }
  
              $sResult  = json_encode($aResult);
              $response = new Response($sResult);
              $response->headers->set('Content-Type', 'application/json');
  
              return $response;
  
          }
code: public function updateAction(Request $request)
          {
  
              try {
                  $id = $this->getUser()->getId();
  
                  /** @var User $oUser */
                  $oUser = UserQuery::create()->findOneById($id);
  
                  if ($oUser === null) {
                      throw $this->createNotFoundException('Unable to find User entity.');
                  }
  
                  $aPost = $request->request->get("form");
  
  
                  $nbUpdatedRows = UserQuery::create()
                      ->filterById($id)
                      ->update(array('NotificationError' => isset($aPost['notification_error']), 'NotificationChange' => isset($aPost['notification_change'])));
  
  
                  $aResult = array(
                      "success" => true,
                      "message" => $this->get("translator")->trans("notificationcenter.save.successful")
                  );
  
              } catch (\Exception $e) {
                  $aResult = array(
                      "success" => false,
                      "message" => $this->get("translator")->trans("notificationcenter.save.failed") . ":<br>" . $e->getMessage()
                  );
              }
  
              $sResult  = json_encode($aResult);
              $response = new Response($sResult);
              $response->headers->set('Content-Type', 'application/json');
  
              return $response;
  
          }
code_tokens: public function updateAction ( Request $ request ) { try { $ id = $ this -> getUser ( ) -> getId ( ) ; /** @var User $oUser */ $ oUser = UserQuery :: create ( ) -> findOneById ( $ id ) ; if ( $ oUser === null ) { throw $ this -> createNotFoundException ( 'Unable to find User entity.' ) ; } $ aPost = $ request -> request -> get ( "form" ) ; $ nbUpdatedRows = UserQuery :: create ( ) -> filterById ( $ id ) -> update ( array ( 'NotificationError' => isset ( $ aPost [ 'notification_error' ] ) , 'NotificationChange' => isset ( $ aPost [ 'notification_change' ] ) ) ) ; $ aResult = array ( "success" => true , "message" => $ this -> get ( "translator" ) -> trans ( "notificationcenter.save.successful" ) ) ; } catch ( \ Exception $ e ) { $ aResult = array ( "success" => false , "message" => $ this -> get ( "translator" ) -> trans ( "notificationcenter.save.failed" ) . ":<br>" . $ e -> getMessage ( ) ) ; } $ sResult = json_encode ( $ aResult ) ; $ response = new Response ( $ sResult ) ; $ response -> headers -> set ( 'Content-Type' , 'application/json' ) ; return $ response ; }
docstring: Update notification settings
  
  @param \Symfony\Component\HttpFoundation\Request $request
  
  @return \Symfony\Component\HttpFoundation\Response
docstring_tokens: Update notification settings