public function postFormSubmit(FormSubmitEvent $event)
    {
        $post = $event->getPost();

        $mailinglists = $email = null;
        foreach ($post->getValueSet()->getValues() as $value) {
            if ($value instanceof MailingListSubscribeValue && $value->getValue() == true) {
                $parameters = $value->getAttribute()->getParameters();
                if (isset($parameters['mailingLists'])) {
                    $mailinglists = $this->mailingListManager->getRepository()->findByIds($parameters['mailingLists']);
                }

            } elseif ($value instanceof EmailValue) {
                $email = $value->getValue();
            }
        }

        if ($email && $mailinglists) {
            foreach ($mailinglists as $mailinglist) {
                $subscription = new Subscription();
                $subscription->setEmail($email);
                $subscription->setMailingList($mailinglist);

                $this->subscriptionManager->save($subscription);
            }
        }
    }
public function postFormSubmit(FormSubmitEvent $event)
    {
        $post = $event->getPost();

        $mailinglists = $email = null;
        foreach ($post->getValueSet()->getValues() as $value) {
            if ($value instanceof MailingListSubscribeValue && $value->getValue() == true) {
                $parameters = $value->getAttribute()->getParameters();
                if (isset($parameters['mailingLists'])) {
                    $mailinglists = $this->mailingListManager->getRepository()->findByIds($parameters['mailingLists']);
                }

            } elseif ($value instanceof EmailValue) {
                $email = $value->getValue();
            }
        }

        if ($email && $mailinglists) {
            foreach ($mailinglists as $mailinglist) {
                $subscription = new Subscription();
                $subscription->setEmail($email);
                $subscription->setMailingList($mailinglist);

                $this->subscriptionManager->save($subscription);
            }
        }
    }
public function postFormSubmit ( FormSubmitEvent $ event ) { $ post = $ event -> getPost ( ) ; $ mailinglists = $ email = null ; foreach ( $ post -> getValueSet ( ) -> getValues ( ) as $ value ) { if ( $ value instanceof MailingListSubscribeValue && $ value -> getValue ( ) == true ) { $ parameters = $ value -> getAttribute ( ) -> getParameters ( ) ; if ( isset ( $ parameters [ 'mailingLists' ] ) ) { $ mailinglists = $ this -> mailingListManager -> getRepository ( ) -> findByIds ( $ parameters [ 'mailingLists' ] ) ; } } elseif ( $ value instanceof EmailValue ) { $ email = $ value -> getValue ( ) ; } } if ( $ email && $ mailinglists ) { foreach ( $ mailinglists as $ mailinglist ) { $ subscription = new Subscription ( ) ; $ subscription -> setEmail ( $ email ) ; $ subscription -> setMailingList ( $ mailinglist ) ; $ this -> subscriptionManager -> save ( $ subscription ) ; } } }
This method is called right after the post is stored in the database during the Form submit.

@param FormSubmitEvent $event
This method is called right after the post is stored in the database during the Form submit .