- modal backdrop, pas de backdrop, pas de problème...
This commit is contained in:
Jérémy Guillot
2024-06-10 15:25:06 +02:00
parent c46e1a0a5c
commit 0455ab40d9
5 changed files with 69 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Twig\Components;
use App\Repository\MangaRepository;
use App\Service\MangadexProvider;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
@@ -20,7 +21,7 @@ class MangaSearch
#[LiveProp(writable: true)]
public ?string $query = null;
public function __construct(private readonly MangadexProvider $mangadexProvider)
public function __construct(private readonly MangadexProvider $mangadexProvider, private MangaRepository $mangaRepository)
{
}
@@ -29,10 +30,12 @@ class MangaSearch
*/
public function getMangas(): Collection|null
{
if ($this->query === null || $this->query === '') {
return null;
}
return new ArrayCollection($this->mangaRepository->findAll());
return $this->mangadexProvider->search($this->query);
// if ($this->query === null || $this->query === '') {
// return null;
// }
//
// return $this->mangadexProvider->search($this->query);
}
}