- trop de trucs d'un coup... je vais faire attention ensuite ^^'
This commit is contained in:
@@ -6,8 +6,8 @@ use App\Entity\Manga;
|
||||
use App\Repository\MangaRepository;
|
||||
use App\Service\MangaExportService;
|
||||
use App\Service\LelScansProviderService;
|
||||
use App\Service\MangaScraperService;
|
||||
use App\Service\MangaUpdatesDbProvider;
|
||||
use App\Service\MangaScraperServiceOld;
|
||||
use App\Service\MangaUpdatesMetadataProvider;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -20,11 +20,11 @@ use Symfony\Component\String\Slugger\AsciiSlugger;
|
||||
class MangaController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly MangaScraperService $mangaScraperService,
|
||||
private readonly MangaScraperServiceOld $mangaScraperService,
|
||||
private readonly MangaExportService $mangaExportService,
|
||||
private readonly LelScansProviderService $mangaProviderService,
|
||||
private readonly MangaRepository $mangaRepository,
|
||||
private MangaUpdatesDbProvider $mangaUpdatesDbProvider
|
||||
private MangaUpdatesMetadataProvider $mangaUpdatesDbProvider
|
||||
)
|
||||
{
|
||||
}
|
||||
@@ -48,12 +48,17 @@ class MangaController extends AbstractController
|
||||
throw new NotFoundHttpException("Le manga demandé n'existe pas.");
|
||||
}
|
||||
|
||||
$availableChapters = $this->mangaProviderService->getChapterList($mangaSlug);
|
||||
$chaptersByVolume = [];
|
||||
foreach ($manga->getChapters() as $chapter) {
|
||||
$volume = $chapter->getVolume() ?? 'Not Found';
|
||||
$chaptersByVolume[$volume][] = $chapter;
|
||||
}
|
||||
|
||||
$chaptersByVolume = array_map('array_reverse', array_reverse($chaptersByVolume, true));
|
||||
|
||||
return $this->render('manga/show_chapters.html.twig', [
|
||||
'controller_name' => 'MangaController',
|
||||
'chapters_by_volume' => $chaptersByVolume,
|
||||
'manga' => $manga,
|
||||
'availableChapters' => $availableChapters,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -83,19 +88,11 @@ class MangaController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/addNew', name: 'add_new_manga')]
|
||||
public function addNew(): Response
|
||||
#[Route('/addNew/{query}', name: 'add_new_manga')]
|
||||
public function addNew(string $query = ''): Response
|
||||
{
|
||||
$availableManga = $this->mangaProviderService->getMangaList();
|
||||
|
||||
foreach ($availableManga as $key => $manga) {
|
||||
$availableManga[$key]['slug'] = $this->titleToSlug($manga['name']);
|
||||
}
|
||||
|
||||
$mangas = $this->mangaRepository->findAll();
|
||||
return $this->render('manga/add_new.html.twig', [
|
||||
'availableManga' => $availableManga,
|
||||
'mangas' => $mangas,
|
||||
'query' => $query,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
30
src/Controller/TestController.php
Normal file
30
src/Controller/TestController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Chapter;
|
||||
use App\Entity\ContentSource;
|
||||
use App\Entity\Manga;
|
||||
use App\Repository\MangaRepository;
|
||||
use App\Service\MangadexProvider;
|
||||
use App\Service\MangaScraperService;
|
||||
use App\Service\MangaUpdatesMetadataProvider;
|
||||
use App\Service\SushiScanProviderService;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class TestController extends AbstractController
|
||||
{
|
||||
public function __construct(private MangadexProvider $mangadexProvider, private MangaRepository $mangaRepository)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/test', name: 'test')]
|
||||
public function test(): Response
|
||||
{
|
||||
$manga = $this->mangaRepository->find(8);
|
||||
|
||||
dd($this->mangadexProvider->getFeed($manga));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user