original_string: public function add()
      {
          $form = $this->getForm();
          $this->set(compact('form'));
          
          if (!$form->wasSubmitted()) {
              return;
          }
          
          try {
              $this->getUpdateService()
                  ->setForm($form)
                  ->update();
              ;
          } catch (InvalidFormDataException $caught) {
              Log::logger()->addNotice($caught->getMessage(), $form->getData());
              $this->addErrorMessage($this->getInvalidFormDataMessage());
              return;
          } catch (\Exception $caught) {
              Log::logger()->addCritical(
                  $caught->getMessage(),
                  $form->getData()
              );
              $this->addErrorMessage($this->getGeneralErrorMessage($caught));
              return;
          }
          
          $this->addSuccessMessage(
              $this->getCreateSuccessMessage(
                  $this->getUpdateService()->getEntity()
              )
          );
          $this->redirectFromCreated($this->getUpdateService()->getEntity());
      }
code: public function add()
      {
          $form = $this->getForm();
          $this->set(compact('form'));
          
          if (!$form->wasSubmitted()) {
              return;
          }
          
          try {
              $this->getUpdateService()
                  ->setForm($form)
                  ->update();
              ;
          } catch (InvalidFormDataException $caught) {
              Log::logger()->addNotice($caught->getMessage(), $form->getData());
              $this->addErrorMessage($this->getInvalidFormDataMessage());
              return;
          } catch (\Exception $caught) {
              Log::logger()->addCritical(
                  $caught->getMessage(),
                  $form->getData()
              );
              $this->addErrorMessage($this->getGeneralErrorMessage($caught));
              return;
          }
          
          $this->addSuccessMessage(
              $this->getCreateSuccessMessage(
                  $this->getUpdateService()->getEntity()
              )
          );
          $this->redirectFromCreated($this->getUpdateService()->getEntity());
      }
code_tokens: public function add ( ) { $ form = $ this -> getForm ( ) ; $ this -> set ( compact ( 'form' ) ) ; if ( ! $ form -> wasSubmitted ( ) ) { return ; } try { $ this -> getUpdateService ( ) -> setForm ( $ form ) -> update ( ) ; ; } catch ( InvalidFormDataException $ caught ) { Log :: logger ( ) -> addNotice ( $ caught -> getMessage ( ) , $ form -> getData ( ) ) ; $ this -> addErrorMessage ( $ this -> getInvalidFormDataMessage ( ) ) ; return ; } catch ( \ Exception $ caught ) { Log :: logger ( ) -> addCritical ( $ caught -> getMessage ( ) , $ form -> getData ( ) ) ; $ this -> addErrorMessage ( $ this -> getGeneralErrorMessage ( $ caught ) ) ; return ; } $ this -> addSuccessMessage ( $ this -> getCreateSuccessMessage ( $ this -> getUpdateService ( ) -> getEntity ( ) ) ) ; $ this -> redirectFromCreated ( $ this -> getUpdateService ( ) -> getEntity ( ) ) ; }
docstring: Handle the add entity request
docstring_tokens: Handle the add entity request