Clean up obsolete survey editor and DCA code

This commit is contained in:
Jürgen Mummert
2026-06-07 22:16:37 +02:00
parent 497b4f962d
commit b7bcdd8372
10 changed files with 6 additions and 95 deletions
@@ -76,7 +76,7 @@ final class MemberSurveyEditController extends AbstractFrontendModuleController
$surveyForm = $this->formFactory->createNamed('survey_meta', SurveyEditorType::class, $survey instanceof SurveyModel ? SurveyEditorData::fromModel($survey) : new SurveyEditorData());
$surveyForm->handleRequest($request);
if ($surveyForm->isSubmitted() && $surveyForm->isValid()) {
if ($surveyForm->isSubmitted() && $surveyForm->isValid() && (!$survey instanceof SurveyModel || '1' !== (string) $survey->published)) {
try {
if ($survey instanceof SurveyModel) {
$this->surveyEditorService->updateSurvey($survey, $memberId, $surveyForm->getData());
@@ -92,6 +92,8 @@ final class MemberSurveyEditController extends AbstractFrontendModuleController
} catch (\Throwable $exception) {
$this->addFlash('error', $exception->getMessage());
}
} elseif ($surveyForm->isSubmitted() && $survey instanceof SurveyModel && '1' === (string) $survey->published) {
$this->addFlash('error', 'Die Metadaten können nach der Veröffentlichung im Frontend nicht mehr geändert werden.');
}
if (!$survey instanceof SurveyModel) {
-23
View File
@@ -242,16 +242,6 @@ final class SurveyDcaListener
return $surveyId > 0 ? $this->surveyEditorRepository->findMemberIdsBySurvey($surveyId) : [];
}
public function guardContentSave(mixed $value, DataContainer $dataContainer): mixed
{
return $value;
}
public function guardConditionSave(mixed $value, DataContainer $dataContainer): mixed
{
return $value;
}
public function guardEditorSave(mixed $value, DataContainer $dataContainer): mixed
{
$surveyId = $this->resolveSurveyId('tl_survey_editor', $dataContainer);
@@ -389,10 +379,6 @@ final class SurveyDcaListener
$this->surveyRepository->refreshListMetadata($surveyId);
}
public function guardContentDelete(DataContainer $dataContainer): void
{
}
public function touchSurveyContentParent(DataContainer $dataContainer): void
{
$surveyId = $this->resolveSurveyId('tl_survey_content', $dataContainer);
@@ -402,10 +388,6 @@ final class SurveyDcaListener
}
}
public function guardConditionDelete(DataContainer $dataContainer): void
{
}
public function touchSurveyConditionParent(DataContainer $dataContainer): void
{
$surveyId = $this->resolveSurveyId('tl_survey_condition', $dataContainer);
@@ -424,11 +406,6 @@ final class SurveyDcaListener
}
}
public function guardSurveyStructureSave(mixed $value, DataContainer $dataContainer): mixed
{
return $value;
}
public function resolveSurveyContentPalette(string $palette, DataContainer $dataContainer): string
{
$type = (string) ($dataContainer->activeRecord->type ?? '');
-3
View File
@@ -10,14 +10,12 @@ final class SurveyEditorData
{
public string $title = '';
public string $description = '';
public bool $published = false;
public static function fromModel(SurveyModel $survey): self
{
$data = new self();
$data->title = (string) $survey->title;
$data->description = (string) $survey->description;
$data->published = '1' === (string) $survey->published;
return $data;
}
@@ -30,7 +28,6 @@ final class SurveyEditorData
return [
'title' => $this->title,
'description' => $this->description,
'published' => $this->published,
];
}
}
-5
View File
@@ -6,7 +6,6 @@ namespace Mummert\SurveyBundle\Form;
use Mummert\SurveyBundle\Form\Model\SurveyEditorData;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
@@ -29,10 +28,6 @@ final class SurveyEditorType extends AbstractType
'empty_data' => '',
'attr' => ['rows' => 5],
])
->add('published', CheckboxType::class, [
'label' => 'Veröffentlicht',
'required' => false,
])
;
}