fix: creates separate Symfony Message Handler for download

This commit is contained in:
2025-04-23 15:38:39 -05:00
parent a5c827b48f
commit 5402680abf
6 changed files with 104 additions and 142 deletions

View File

@@ -9,11 +9,9 @@ use App\Download\Downloader\DownloaderInterface;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\HandlerInterface;
use OneToMany\RichBundle\Contract\ResultInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
/** @implements HandlerInterface<DownloadMediaCommand, DownloadMediaResult> */
#[AsMessageHandler]
readonly class DownloadMediaHandler implements HandlerInterface
{
public function __construct(
@@ -21,11 +19,6 @@ readonly class DownloadMediaHandler implements HandlerInterface
private DownloadRepository $downloadRepository,
) {}
public function __invoke(CommandInterface $command)
{
$this->handle($command);
}
public function handle(CommandInterface $command): ResultInterface
{
$download = $this->downloadRepository->insert(