Skip to content

Commit 48a50f0

Browse files
authored
Merge pull request #64 from sitegeist/bugfix/fixPersistenceOfChangedGlosaryEntries
BUGFIX: fix persistence of changed glosary entries
2 parents 357abde + 92fbb3d commit 48a50f0

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

Classes/Controller/LostInTranslationModuleController.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Neos\Flow\Annotations as Flow;
1212
use Sitegeist\LostInTranslation\Domain\Model\Glossary;
1313
use Sitegeist\LostInTranslation\Domain\Model\GlossaryEntry;
14+
use Sitegeist\LostInTranslation\Domain\Repository\GlossaryEntryRepository;
1415
use Sitegeist\LostInTranslation\Domain\Repository\GlossaryRepository;
1516
use Sitegeist\LostInTranslation\Infrastructure\DeepL\DeepLCacheService;
1617
use Sitegeist\LostInTranslation\Infrastructure\DeepL\DeepLCustomAuthenticationKeyService;
@@ -43,6 +44,12 @@ class LostInTranslationModuleController extends AbstractModuleController
4344
*/
4445
protected $glossaryRepository;
4546

47+
/**
48+
* @var GlossaryEntryRepository
49+
* @Flow\Inject
50+
*/
51+
protected $glossaryEntryRepository;
52+
4653
/**
4754
* @Flow\Inject
4855
* @var DeepLCustomAuthenticationKeyService
@@ -211,10 +218,15 @@ public function editGlossaryEntryAction(GlossaryEntry $entry): void
211218

212219
public function updateGlossaryEntryAction(GlossaryEntry $entry, string $sourceText, string $targetText): void
213220
{
221+
214222
$entry->sourceText = $sourceText;
215223
$entry->targetText = $targetText;
216-
$entry->glossary->updateModificationDate();
224+
$this->glossaryEntryRepository->update($entry);
225+
226+
$glossary = $entry->glossary;
227+
$glossary->updateModificationDate();
217228
$this->glossaryRepository->update($entry->glossary);
229+
218230
$this->forward(actionName: 'showGlossary', arguments: ['glossary' => $entry->glossary]);
219231
}
220232

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sitegeist\LostInTranslation\Domain\Repository;
6+
7+
use Neos\Flow\Annotations as Flow;
8+
use Neos\Flow\Persistence\Repository;
9+
use Sitegeist\LostInTranslation\Domain\Model\Glossary;
10+
11+
/**
12+
* @Flow\Scope("singleton")
13+
*/
14+
class GlossaryEntryRepository extends Repository
15+
{
16+
}

0 commit comments

Comments
 (0)