Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com>
This commit is contained in:
Jonas Rittershofer 2021-02-05 17:21:49 +01:00
Родитель ab7809b5f4
Коммит a7aecac31f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A865740F334316E0
2 изменённых файлов: 22 добавлений и 1 удалений

Просмотреть файл

@ -895,7 +895,7 @@ class ApiController extends Controller {
}
// Delete submission (incl. Answers)
$this->submissionMapper->delete($submission);
$this->submissionMapper->deleteById($id);
return new DataResponse($id);
}

Просмотреть файл

@ -107,6 +107,27 @@ class SubmissionMapper extends QBMapper {
}
/**
* Delete the Submission, including answers.
* @param int $id of the submission to delete
*/
public function deleteById(int $id): void {
$qb = $this->db->getQueryBuilder();
// First delete corresponding answers.
$submissionEntity = $this->findById($id);
$this->answerMapper->deleteBySubmission($submissionEntity->getId());
//Delete Submission
$qb->delete($this->getTableName())
->where(
$qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))
);
$qb->execute();
}
/**
* Delete all Submissions corresponding to form, including answers.
* @param int $formId
*/
public function deleteByForm(int $formId): void {