Skip to content

Commit

Permalink
Remove recreate mod when changing mod type
Browse files Browse the repository at this point in the history
  • Loading branch information
jskowronski39 committed Jan 7, 2024
1 parent 9ba4259 commit 7e7f773
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Controller/Mod/UpdateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ public function __invoke(Request $request, AbstractMod $mod): Response
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$updatedMod = $this->dataTransformerRegistry->transformToEntity($modFormDto, $mod);

if (!$this->entityManager->contains($updatedMod)) {
$this->entityManager->remove($mod);
$this->entityManager->persist($updatedMod);
}
$this->dataTransformerRegistry->transformToEntity($modFormDto, $mod);

$this->entityManager->flush();

Expand Down

0 comments on commit 7e7f773

Please sign in to comment.