/** * action create * * @param \PIXELINK\PxCleverreach\Domain\Model\Newsletter $newNewsletter * @return void */ public function createAction(\PIXELINK\PxCleverreach\Domain\Model\Newsletter $newNewsletter) { $newNewsletter->setPid($this->pageId); $result = $this->createNewsletter($newNewsletter); if ($result->status == 'SUCCESS') { $newNewsletter->setEmailId($result->data->id); $group = $this->cleverreachApi->groupGetDetails($this->settings['apiKey'], $newNewsletter->getGroupId()); $newNewsletter->setGroupName($group->status === 'SUCCESS' ? $group->data->name : ''); $this->newsletterRepository->add($newNewsletter); $this->addFlashMessage(LocalizationUtility::translate('pixelinknewsletter_newsletter.newsletter_created', $this->request->getControllerExtensionKey()), LocalizationUtility::translate('pixelinknewsletter_newsletter.newsletter_created_header', $this->request->getControllerExtensionKey()), \TYPO3\CMS\Core\Messaging\AbstractMessage::OK); $this->addFlashMessage(sprintf(LocalizationUtility::translate('pixelinknewsletter_newsletter.newsletter_detail_link', $this->request->getControllerExtensionKey()), $this->settings['emailBaseUrl'] . $result->data->id), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK); } else { $this->addFlashMessage(LocalizationUtility::translate('pixelinknewsletter_newsletter.newsletter_not_created', $this->request->getControllerExtensionKey()) . $result->message, 'Error', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); } $this->redirect('list'); }
/** * @test */ public function setPageIdForStringSetsPageId() { $this->subject->setPageId('Conceived at T3CON10'); $this->assertAttributeEquals('Conceived at T3CON10', 'pageId', $this->subject); }