- activity on menu
- starting activity page
This commit is contained in:
2024-06-17 22:36:37 +02:00
parent 671551c7f8
commit f7bb7b9148
14 changed files with 524 additions and 33 deletions

View File

@@ -12,7 +12,7 @@ use Symfony\Component\String\Slugger\SluggerInterface;
readonly class MangadexProvider implements MetadataProviderInterface
{
public function __construct(private ClientInterface $client, private SluggerInterface $slugger)
public function __construct(private ClientInterface $client, private SluggerInterface $slugger, private NotificationService $notificationService)
{
}
@@ -22,12 +22,17 @@ readonly class MangadexProvider implements MetadataProviderInterface
return new ArrayCollection();
}
$results = $this->client->get('/manga', [
'title' => $title,
'contentRating' => ['safe', 'suggestive'],
'includes' => ['cover_art', 'author'],
'limit' => 25
]);
try{
$results = $this->client->get('/manga', [
'title' => $title,
'contentRating' => ['safe', 'suggestive'],
'includes' => ['cover_art', 'author'],
'limit' => 25
]);
}catch(\Exception $e){
$this->notificationService->sendUpdate('notification', ['status' => 'error', 'message' => 'An error occurred while fetching data from Mangadex.']);
return new ArrayCollection();
}
$mangas = [];
foreach ($results['data'] as $result) {