- trop de trucs d'un coup... je vais faire attention ensuite ^^'

This commit is contained in:
Jérémy Guillot
2024-06-10 13:57:50 +02:00
parent 9595831aa3
commit c46e1a0a5c
69 changed files with 4004 additions and 385 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Twig\Components;
use App\Service\MangadexProvider;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Exception;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
use Symfony\UX\LiveComponent\ComponentToolsTrait;
use Symfony\UX\LiveComponent\DefaultActionTrait;
use Symfony\UX\LiveComponent\ValidatableComponentTrait;
#[AsLiveComponent]
class MangaSearch
{
use DefaultActionTrait;
#[LiveProp(writable: true)]
public ?string $query = null;
public function __construct(private readonly MangadexProvider $mangadexProvider)
{
}
/**
* @throws Exception
*/
public function getMangas(): Collection|null
{
if ($this->query === null || $this->query === '') {
return null;
}
return $this->mangadexProvider->search($this->query);
}
}