Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Classes/Event/GlossarySyncDone.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace WebVision\Deepltranslate\Glossary\Event;

/**
* Event is dispatched when the sync to DeepL was finished.
*
* It carries the page ID of the synched glossary.
*/
final class GlossarySyncDone
{
public function __construct(public readonly int $pageId)
Copy link
Member

@sbuerk sbuerk Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to talk with my collegue, but I guess we are stating with private properties for now and using getter/getter&setters .. needs to be revisited and rethinked.

Coming back on this later.

Copy link
Author

@koehnlein koehnlein Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
}
}
10 changes: 9 additions & 1 deletion Classes/Service/DeeplGlossaryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
use DeepL\GlossaryInfo;
use DeepL\GlossaryLanguagePair;
use Doctrine\DBAL\Driver\Exception;
use Psr\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use WebVision\Deepltranslate\Core\ClientInterface;
use WebVision\Deepltranslate\Glossary\Domain\Repository\GlossaryRepository;
use WebVision\Deepltranslate\Glossary\Event\GlossarySyncDone;
use WebVision\Deepltranslate\Glossary\Exception\FailedToCreateGlossaryException;
use WebVision\Deepltranslate\Glossary\Exception\GlossaryEntriesNotExistException;

Expand All @@ -24,14 +26,18 @@ final class DeeplGlossaryService

protected GlossaryRepository $glossaryRepository;

protected EventDispatcherInterface $eventDispatcher;

public function __construct(
FrontendInterface $cache,
ClientInterface $client,
GlossaryRepository $glossaryRepository
GlossaryRepository $glossaryRepository,
EventDispatcherInterface $eventDispatcher,
) {
$this->cache = $cache;
$this->client = $client;
$this->glossaryRepository = $glossaryRepository;
$this->eventDispatcher = $eventDispatcher;
}

/**
Expand Down Expand Up @@ -170,5 +176,7 @@ public function syncGlossaries(int $uid): void
$glossaryInformation->uid
);
}

$this->eventDispatcher->dispatch(new GlossarySyncDone($uid));
}
}