FormHandler/AbstractMessageFormHandler.php
/**
     * Processes the form with the request.
     *
     * @param FormInterface $form
     *
     * @param Request $request
     *
     * @return MessageInterface|null the sent message if the form is bound and valid, false otherwise
     *
     * @throws Exception
     * @throws SubmittedMessageValidationException
     */
Processes the form with the request.

@param Request $request

@return MessageInterface|null the sent message if the form is bound and valid, false otherwise

@throws Exception
@throws SubmittedMessageValidationException
Processes the form with the request . @param Request $request @return MessageInterface|null the sent message if the form is bound and valid false otherwise @throws Exception @throws SubmittedMessageValidationException
public function process(FormInterface $form, Request $request): ?MessageInterface
    {
        $form->handleRequest($request);
        if ($form->isSubmitted() === false) {
            return null;
        }
        if ($form->isValid()) {
            $formMessage = $form->getData();
            $message = $this->composeMessage($formMessage);
            $fileNames = $this->uploadedFileManager->moveToDirAndReturnFileNames(
                $formMessage->getAttachments(),
                'attachment',
                $this->pathToAttachmentsDir
            );
            $message->addMessageAttachments($fileNames, $this->messageAttachmentFactory);
            $this->sender->send($message);
            return $message;
        }
        throw new SubmittedMessageValidationException($form->getErrors(), 'Form data is invalid');
    }
public function process ( FormInterface $ form , Request $ request ) : ? MessageInterface { $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) === false ) { return null ; } if ( $ form -> isValid ( ) ) { $ formMessage = $ form -> getData ( ) ; $ message = $ this -> composeMessage ( $ formMessage ) ; $ fileNames = $ this -> uploadedFileManager -> moveToDirAndReturnFileNames ( $ formMessage -> getAttachments ( ) , 'attachment' , $ this -> pathToAttachmentsDir ) ; $ message -> addMessageAttachments ( $ fileNames , $ this -> messageAttachmentFactory ) ; $ this -> sender -> send ( $ message ) ; return $ message ; } throw new SubmittedMessageValidationException ( $ form -> getErrors ( ) , 'Form data is invalid' ) ; }
Processes the form with the request.
Processes the form with the request .
/**
             * @var AbstractMessage $formMessage
             */