From 68f2cc34c901b74c176bd05ed9956cc23452b252 Mon Sep 17 00:00:00 2001 From: Stefan Galinski <stefan@sgalinski.de> Date: Wed, 13 Dec 2017 23:26:45 +0100 Subject: [PATCH] [TASK] Save the application in the end finally --- Classes/Controller/JoblistController.php | 24 +++++++------ .../Repository/JobApplicationRepository.php | 35 +++++++++++++++++++ 2 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 Classes/Domain/Repository/JobApplicationRepository.php diff --git a/Classes/Controller/JoblistController.php b/Classes/Controller/JoblistController.php index b3508d01..ca825e0c 100644 --- a/Classes/Controller/JoblistController.php +++ b/Classes/Controller/JoblistController.php @@ -53,6 +53,12 @@ class JoblistController extends ActionController { */ private $jobRepository; + /** + * @var \SGalinski\SgJobs\Domain\Repository\JobApplicationRepository + * @inject + */ + private $jobApplicationRepository; + /** * Show all job offers and options to manage them * @@ -104,15 +110,6 @@ class JoblistController extends ActionController { * @param string|NULL $folderName */ public function applyFormAction(JobApplication $applyData = NULL, $error = NULL, $folderName = NULL) { -// $uploadedFiles = $this->getExistingApplicationFiles($uniqueFolderName); -// if (\count($uploadedFiles['coverLetter']) <= 0 && \count($uploadedFiles['cv']) <= 0 -// && \count($uploadedFiles['certificate']) <= 0 -// ) { -// $this->forward('applyForm', NULL, NULL, ['error' => 'Bitte laden Sie alle benötigten Dateien hoch!']); -// } - -// $this->request->setArgument('uploadedFiles', $uploadedFiles); - if ($error !== NULL && $error !== '') { $this->view->assign('internalError', $error); } @@ -211,8 +208,13 @@ class JoblistController extends ActionController { public function applyAction(JobApplication $applyData) { try { $applyData->setPid($GLOBALS['TSFE']->id); - // @TODO repository is missing / OR UPDATE!!! -// $this->jobApplicationRepository->add($applyData); + + if ($applyData->_isNew()) { + $this->jobApplicationRepository->add($applyData); + } else { + $this->jobApplicationRepository->update($applyData); + } + $folderName = $this->request->getArgument('folderName'); $this->submitApplicationFiles($applyData, $folderName); diff --git a/Classes/Domain/Repository/JobApplicationRepository.php b/Classes/Domain/Repository/JobApplicationRepository.php new file mode 100644 index 00000000..80399cae --- /dev/null +++ b/Classes/Domain/Repository/JobApplicationRepository.php @@ -0,0 +1,35 @@ +<?php + +namespace SGalinski\SgJobs\Domain\Repository; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +use TYPO3\CMS\Extbase\Persistence\Repository; + +/** + * Job Repository + */ +class JobApplicationRepository extends Repository { +} -- GitLab