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());
    }
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());
    }
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 ( ) ) ; }
Handle the add entity request
Handle the add entity request