feat: integrate with MailJet API for newsletter registration

This commit is contained in:
Björn Fromme
2026-03-19 09:42:00 +01:00
parent 66c55f0722
commit d1e2bf3e7d
26 changed files with 1537 additions and 47 deletions
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Repository\NewsletterOptInConfirmationRepository;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: 'app:cleanup:newsletter-opt-in-requests',
description: 'Removes expired pending newsletter double opt-in requests',
)]
class CleanupNewsletterOptInRequestsCommand extends Command
{
public function __construct(
private readonly NewsletterOptInConfirmationRepository $confirmationRepository,
private readonly LoggerInterface $logger,
) {
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$deletedCount = $this->confirmationRepository->deleteExpiredPending();
if (0 === $deletedCount) {
$io->success('No expired pending newsletter opt-in requests found.');
return Command::SUCCESS;
}
$this->logger->info('Deleted expired pending newsletter opt-in requests', [
'count' => $deletedCount,
]);
$io->success(sprintf('Deleted %d expired pending newsletter opt-in request(s).', $deletedCount));
return Command::SUCCESS;
}
}