src/FondOfSpryker/Yves/AvailabilityAlert/Controller/SubmitController.php
protected function processSubscriptionForm(FormInterface $form, Request $request): bool
    {
        if (!$form->isSubmitted() || !$form->isValid()) {
            return false;
        }
        
        $availabilityAlertSubscriptionResponseTransfer = $this->getFactory()
            ->getAvailabilityAlertClient()
            ->subscribe(
                $this->getSubscriptionFormData($form)
                    ->setLocaleName($this->getLocale())
                    ->setStore(Store::getInstance()->getStoreName())
            );

        if ($availabilityAlertSubscriptionResponseTransfer->getIsSuccess()) {
            $request->getSession()
                ->getFlashBag()
                ->add('availability-alert-success', 'availibility_alert.feedback.success');

            return true;
        }

        $error = new FormError($availabilityAlertSubscriptionResponseTransfer->getErrors()[0]->getMessage());

        $form->addError($error);

        return false;
    }
protected function processSubscriptionForm(FormInterface $form, Request $request): bool
    {
        if (!$form->isSubmitted() || !$form->isValid()) {
            return false;
        }
        
        $availabilityAlertSubscriptionResponseTransfer = $this->getFactory()
            ->getAvailabilityAlertClient()
            ->subscribe(
                $this->getSubscriptionFormData($form)
                    ->setLocaleName($this->getLocale())
                    ->setStore(Store::getInstance()->getStoreName())
            );

        if ($availabilityAlertSubscriptionResponseTransfer->getIsSuccess()) {
            $request->getSession()
                ->getFlashBag()
                ->add('availability-alert-success', 'availibility_alert.feedback.success');

            return true;
        }

        $error = new FormError($availabilityAlertSubscriptionResponseTransfer->getErrors()[0]->getMessage());

        $form->addError($error);

        return false;
    }
protected function processSubscriptionForm ( FormInterface $ form , Request $ request ) : bool { if ( ! $ form -> isSubmitted ( ) || ! $ form -> isValid ( ) ) { return false ; } $ availabilityAlertSubscriptionResponseTransfer = $ this -> getFactory ( ) -> getAvailabilityAlertClient ( ) -> subscribe ( $ this -> getSubscriptionFormData ( $ form ) -> setLocaleName ( $ this -> getLocale ( ) ) -> setStore ( Store :: getInstance ( ) -> getStoreName ( ) ) ) ; if ( $ availabilityAlertSubscriptionResponseTransfer -> getIsSuccess ( ) ) { $ request -> getSession ( ) -> getFlashBag ( ) -> add ( 'availability-alert-success' , 'availibility_alert.feedback.success' ) ; return true ; } $ error = new FormError ( $ availabilityAlertSubscriptionResponseTransfer -> getErrors ( ) [ 0 ] -> getMessage ( ) ) ; $ form -> addError ( $ error ) ; return false ; }
@param \Symfony\Component\Form\FormInterface $form
@param \Symfony\Component\HttpFoundation\Request $request

@return bool
@param \ Symfony \ Component \ Form \ FormInterface $form @param \ Symfony \ Component \ HttpFoundation \ Request $request