Backend\Modules\Mailmotor\Actions\Settings::execute PHP Method

execute() public method

Execute
public execute ( )
    public function execute()
    {
        parent::execute();
        $form = $this->createForm($this->get('mailmotor.form.settings'), new SaveSettings($this->get('fork.settings')));
        $form->handleRequest($this->get('request'));
        if (!$form->isValid()) {
            $this->tpl->assign('form', $form->createView());
            $this->parse();
            $this->display();
            return;
        }
        /** @var SaveSettings $settings */
        $settings = $form->getData();
        // The command bus will handle the saving of the settings in the database.
        $this->get('command_bus')->handle($settings);
        $this->get('event_dispatcher')->dispatch(SettingsSavedEvent::EVENT_NAME, new SettingsSavedEvent($settings));
        return $this->redirect(Model::createURLForAction('Settings', null, null, ['report' => 'saved']));
    }
Settings