コード例 #1
0
 /**
  * Handle form request.
  *
  * @param \Symfony\Component\Form\FormInterface     $form
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return bool
  */
 public function handle(FormInterface $form, Request $request)
 {
     $this->logger->info('UserEditFormHandler handle()');
     if (!$request->isMethod('POST')) {
         return false;
     }
     $form->handleRequest($request);
     if (!$form->isValid()) {
         $this->flashManager->getErrorMessage();
         return false;
     }
     $this->userManager->update($form->getData());
     $this->flashManager->getSuccessMessage('update successfully!');
     return true;
 }
コード例 #2
0
 /**
  * @param FormInterface $form
  * @param Request       $request
  *
  * @return bool
  */
 public function handle(FormInterface $form, Request $request)
 {
     $this->logger->info('MotorCoachCreateHandler handle()');
     if (!$request->isMethod('POST')) {
         return false;
     }
     $form->handleRequest($request);
     if (!$form->isValid()) {
         $this->flashManager->getErrorMessage();
         return false;
     }
     $validMotorCoach = $form->getData();
     $this->motorCoachManager->create($validMotorCoach);
     $this->flashManager->getSuccessMessage('Motor coach was added successfully!');
     return true;
 }
コード例 #3
0
 /**
  * @param FormInterface $form
  * @param Request       $request
  *
  * @return bool
  */
 public function handle(FormInterface $form, Request $request)
 {
     $this->logger->info('TrainEditHandler handle()');
     if (!$request->isMethod('POST')) {
         return false;
     }
     $form->handleRequest($request);
     if (!$form->isValid()) {
         $this->flashManager->getErrorMessage();
         return false;
     }
     $validTrain = $form->getData();
     $this->trainManager->update($validTrain);
     $this->flashManager->getSuccessMessage('Train was updated successfully!');
     return true;
 }
コード例 #4
0
 /**
  * Handle form request.
  *
  * @param \Symfony\Component\Form\FormInterface     $form
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return bool
  */
 public function handle(FormInterface $form, Request $request, User $user)
 {
     $this->logger->info('UserChangePasswordHandler= handle()');
     if (!$request->isMethod('POST')) {
         return false;
     }
     $form->handleRequest($request);
     if (!$form->isValid()) {
         $this->flashManager->getErrorMessage();
         return false;
     }
     $userChangePassword = $form->getData();
     $user->setPassword($userChangePassword->getNewPassword());
     $this->userManager->resetPassword($user);
     $this->flashManager->getSuccessMessage('Your password was changed successfully!');
     return true;
 }