correction url mail

This commit is contained in:
maher
2026-06-10 16:15:23 +02:00
parent 46c35badfd
commit d9c0040374
3 changed files with 8 additions and 13 deletions
+2 -4
View File
@@ -16,14 +16,12 @@
###> symfony/framework-bundle ### ###> symfony/framework-bundle ###
APP_ENV=dev APP_ENV=dev
APP_SECRET= APP_SECRET=06c188eb6b4fe88c6ac5e8
APP_SHARE_DIR=var/share APP_SHARE_DIR=var/share
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
###> symfony/routing ### ###> symfony/routing ###
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands. DEFAULT_URI=https://video.powerpme.com
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
DEFAULT_URI=http://localhost
###< symfony/routing ### ###< symfony/routing ###
###> doctrine/doctrine-bundle ### ###> doctrine/doctrine-bundle ###
+1
View File
@@ -10,6 +10,7 @@ parameters:
listmonk.base_url: '%env(LISTMONK_BASE_URL)%' listmonk.base_url: '%env(LISTMONK_BASE_URL)%'
listmonk.api_user: '%env(LISTMONK_API_USER)%' listmonk.api_user: '%env(LISTMONK_API_USER)%'
listmonk.token: '%env(LISTMONK_TOKEN)%' listmonk.token: '%env(LISTMONK_TOKEN)%'
default.url: '%env(DEFAULT_URI)%'
services: services:
# default configuration for services in *this* file # default configuration for services in *this* file
@@ -9,8 +9,8 @@ use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use App\Service\Frontend\ListmonkMailerService; use App\Service\Frontend\ListmonkMailerService;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
#[AsMessageHandler] #[AsMessageHandler]
class DownloaderVideoHandler class DownloaderVideoHandler
@@ -19,9 +19,10 @@ class DownloaderVideoHandler
private string $path; private string $path;
public function __construct( public function __construct(
#[Autowire('%default.url%')]
private readonly string $defaultUrl,
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private KernelInterface $kernel, private KernelInterface $kernel,
private UrlGeneratorInterface $urlGenerator,
private readonly ListmonkMailerService $mailer, private readonly ListmonkMailerService $mailer,
) { ) {
$this->path = $this->kernel->getProjectDir() . '/public/downloader/user/'; $this->path = $this->kernel->getProjectDir() . '/public/downloader/user/';
@@ -66,18 +67,13 @@ class DownloaderVideoHandler
$this->entityManager->persist($userDownloader); $this->entityManager->persist($userDownloader);
$this->entityManager->flush(); $this->entityManager->flush();
$absoluteURL = $this->urlGenerator->generate( $url = $this->defaultUrl . "/download/user/" . $userDownloader->getId();
'app_frontend_download_user',
['id' => $userDownloader->getId()],
UrlGeneratorInterface::ABSOLUTE_URL
);
$this->mailer->send( $this->mailer->send(
[$user->getEmail()], [$user->getEmail()],
7, 7,
['name'=> $user->getPseudo(), 'video'=> $userDownloader->getName(), 'date'=> $userDownloader->getDateEnd()->format('d/m/Y H:i:s'), 'url'=> $absoluteURL], ['name'=> $user->getPseudo(), 'video'=> $userDownloader->getName(), 'date'=> $userDownloader->getDateEnd()->format('d/m/Y H:i:s'), 'url'=> $url],
'external', 'external',
['Content-Type' => 'application/json; charset=utf-8'] ['Content-Type' => 'application/json; charset=utf-8']
); );