Commit 4bb3af08 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Integrate review feedback

parent e6ea2d9e
......@@ -104,6 +104,8 @@ abstract class AbstractController extends ActionController {
}
/**
* Get the mode from session and switch to it if necessary
*
* @throws NoSuchArgumentException
* @throws StopActionException
* @throws UnsupportedRequestTypeException
......@@ -123,6 +125,8 @@ abstract class AbstractController extends ActionController {
}
/**
* Check if a pid has been set and redirect if there is none
*
* @throws StopActionException
*/
protected function requireSite(): void {
......@@ -145,6 +149,8 @@ abstract class AbstractController extends ActionController {
/**
* Add the message from the request arguments as a flash message
*
* @throws NoSuchArgumentException
*/
protected function addMessage(): void {
......
......@@ -147,6 +147,7 @@ class NewsletterController extends AbstractController {
$this->writeToSession('selectedLanguage', $parameters['selectedLanguage']);
$selectedLanguage = $site->getLanguageById($parameters['selectedLanguage']);
$selectedLanguageId = $selectedLanguage->getLanguageId();
// this should only lead to one entry that corresponds to the selected language
$templatesFromDb = $this->templateRepository->findByTemplateProperties(
$parameters['selectedExtension'],
......@@ -173,37 +174,37 @@ class NewsletterController extends AbstractController {
$template->setIsOverwritten(TRUE);
}
$templates[$selectedLanguage->getLanguageId()] = $template;
$templates[$selectedLanguageId] = $template;
if (!empty($arguments['content'])) {
$templates[$selectedLanguage->getLanguageId()]->setContent($arguments['content']);
$templates[$selectedLanguageId]->setContent($arguments['content']);
}
if (!empty($arguments['cc'])) {
$templates[$selectedLanguage->getLanguageId()]->setCc($arguments['cc']);
$templates[$selectedLanguageId]->setCc($arguments['cc']);
}
if (!empty($arguments['bcc'])) {
$templates[$selectedLanguage->getLanguageId()]->setBcc($arguments['bcc']);
$templates[$selectedLanguageId]->setBcc($arguments['bcc']);
}
if (!empty($arguments['fromName'])) {
$templates[$selectedLanguage->getLanguageId()]->setFromName($arguments['fromName']);
$templates[$selectedLanguageId]->setFromName($arguments['fromName']);
}
if (!empty($arguments['fromMail'])) {
$templates[$selectedLanguage->getLanguageId()]->setFromMail($arguments['fromMail']);
$templates[$selectedLanguageId]->setFromMail($arguments['fromMail']);
}
if (!empty($arguments['replyTo'])) {
$templates[$selectedLanguage->getLanguageId()]->setReplyTo($arguments['replyTo']);
$templates[$selectedLanguageId]->setReplyTo($arguments['replyTo']);
}
if (!empty($arguments['layout'])) {
$templates[$selectedLanguage->getLanguageId()]->setLayout($arguments['layout']);
$templates[$selectedLanguageId]->setLayout($arguments['layout']);
}
if (!empty($arguments['subject'])) {
$templates[$selectedLanguage->getLanguageId()]->setSubject($arguments['subject']);
$templates[$selectedLanguageId]->setSubject($arguments['subject']);
}
}
......
......@@ -95,6 +95,8 @@ class TemplateRepository extends AbstractRepository {
}
/**
* Update Template by its uid
*
* @param int $uid
* @param array $templateData
* @return Template
......@@ -110,6 +112,8 @@ class TemplateRepository extends AbstractRepository {
}
/**
* Create and save a new Template
*
* @param array $templateData
* @return Template
* @throws IllegalObjectTypeException
......@@ -123,6 +127,8 @@ class TemplateRepository extends AbstractRepository {
}
/**
* Fill the given Template with the provided data array
*
* @param Template $template
* @param array $templateData
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment