/**
  * formAction benötigt ein Objekt, string muss erst umgewandelt werden.
  * Als Request (GET/POST) wird die Umwandlung automatisch gemacht.
  * @return void
  */
 public function initializeformAction()
 {
     if ($this->arguments->hasArgument('Newsletter')) {
         $arg = $this->request->getArguments();
         $email = $arg['Newsletter']['email'];
         $propertyMappingConfiguration = $this->arguments->getArgument('Newsletter')->getPropertyMappingConfiguration();
         $propertyMappingConfiguration->allowAllProperties();
         // $propertyMappingConfiguration->allowProperties('email');
         $Newsletter = new \WOEHRL\WoehrlNewsletter\Domain\Model\Newsletter();
         $Newsletter->setEmail($email);
         // $this->request->setArguments('Newsletter',  $arg);
         $propertyMappingConfiguration->setTypeConverterOption('TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\PersistentObjectConverter', \TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, TRUE);
         //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $Newsletter, 'args');
         // $this->view->assign('Newsletter', $Newsletter);
     }
 }
 /**
  * action form
  * @param \WOEHRL\WoehrlNewsletter\Domain\Model\Newsletter $Newsletter
  * @return void
  */
 public function formAction(\WOEHRL\WoehrlNewsletter\Domain\Model\Newsletter $Newsletter = NULL)
 {
     //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $Newsletter, 'args');
     //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $args['email'], 'args');
     //$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $Newsletter, 'result');
     if ($Newsletter) {
         if ($Newsletter->isKindermode()) {
             $kindermode = 1;
         } else {
             $kindermode = 0;
         }
         if ($Newsletter->isHerrenmode()) {
             $herrenmode = 1;
         } else {
             $herrenmode = 0;
         }
         if ($Newsletter->isDamenmode()) {
             $damenmode = 1;
         } else {
             $damenmode = 0;
         }
         $result = $this->getWSDL()->emailAnlegen($Newsletter->getAnrede(), $Newsletter->getTitel(), $Newsletter->getEmail(), ucwords($Newsletter->getVorname()), ucwords($Newsletter->getNachname()), $bestand = 'normal', $Newsletter->getKundennummer(), $Newsletter->getPlz(), $kindermode, $herrenmode, $damenmode);
         if ($result) {
             $subject = "Herzlich Willkommen bei WÖHRL";
             //subject
             $controllerName = 'Newsletter';
             $gender = '';
             $gender = $Newsletter->getAnrede();
             switch ($result) {
                 case 50000:
                     //--Diese E-Mail-Adresse ist bereits registriert.
                     $this->addFlashMessage($messageBody = "<div class='alert alert-danger' role='alert'>Fehler: Es ist bereits ein Benutzer mit der E-Mail-Adresse <b>" . $Newsletter->getEmail() . "</b> registriert!</div>", $messageTitle = "", $severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR, $storeInSession = FALSE);
                     break;
                 case -2:
                     break;
                 default:
                     //Durch eine erfolgreiche Anmeldung wird eine 34 Stellige $Identifikationsnummer zurückgeliefert
                     $link = $this->controllerContext->getUriBuilder()->reset()->setArguments(array('tx_woehrlnewsletter_pi1[action]' => 'subscribe', 'tx_woehrlnewsletter_pi1[key]' => $result))->setTargetPageUid($this->settings['list_detail_pid'])->setCreateAbsoluteUri(true)->buildFrontendUri();
                     $htmlTemplate = $this->getTemplateHtml($controllerName, 'Email', $optMarkers = array('EmpfaengerEmail' => $Newsletter->getEmail(), 'BestaetigungLink' => $link, 'Anrede' => $gender, 'Vorname' => ucwords($Newsletter->getVorname()), 'Nachname' => ucwords($Newsletter->getNachname())));
                     if ($this->sendMail($result, $Newsletter->getEmail(), $htmlTemplate, $subject)) {
                         $Newsletter->setMeldung('2');
                     }
             }
         }
     }
     $this->view->assign('Newsletter', $Newsletter);
 }