toString()), new MangaTitle($command->title), new MangaSlug($command->slug), $command->description, $command->author, $command->publicationYear, $command->genres, $command->status, $command->externalId ? new ExternalId($command->externalId) : null, $command->imageUrl, $command->rating, null, // imageUrls [], // alternativeSlugs ); if (!is_null($command->imageUrl)) { try { $fullImagePath = $this->imageProcessor->downloadImage($command->imageUrl); $thumbnailPath = $this->imageProcessor->createThumbnail($fullImagePath); $manga->updateImageUrls(new ImageUrls($fullImagePath, $thumbnailPath)); } catch (\Exception $e) { throw new \RuntimeException('Erreur lors du traitement de l\'image : '.$e->getMessage()); } } $this->mangaRepository->save($manga); if ($command->externalId) { $this->messageBus->dispatch(new MangaCreated($manga->getId()->getValue(), $command->externalId)); } } }