Version 5.1 - All the GraphQL #32
@ -558,7 +558,7 @@ final class Model {
|
||||
'media_type' => 'Anime',
|
||||
'status' => $status,
|
||||
],
|
||||
'include' => 'media,media.genres,media.mappings,anime.streamingLinks',
|
||||
'include' => 'media,media.categories,media.mappings,anime.streamingLinks',
|
||||
'sort' => '-updated_at'
|
||||
];
|
||||
|
||||
@ -618,7 +618,7 @@ final class Model {
|
||||
'media_type' => 'Manga',
|
||||
'status' => $status,
|
||||
],
|
||||
'include' => 'media,media.genres,media.mappings',
|
||||
'include' => 'media,media.categories,media.mappings',
|
||||
'page' => [
|
||||
'offset' => $offset,
|
||||
'limit' => $limit
|
||||
|
@ -42,7 +42,13 @@ final class AnimeListTransformer extends AbstractTransformer {
|
||||
$animeId = $item['relationships']['media']['data']['id'];
|
||||
$anime = $included['anime'][$animeId];
|
||||
|
||||
$genres = array_column($anime['relationships']['genres'], 'name') ?? [];
|
||||
$genres = [];
|
||||
|
||||
foreach($anime['relationships']['categories'] as $genre)
|
||||
{
|
||||
$genres[] = $genre['title'];
|
||||
}
|
||||
|
||||
sort($genres);
|
||||
|
||||
$rating = (int) $item['attributes']['ratingTwenty'] !== 0
|
||||
|
@ -43,7 +43,13 @@ final class MangaListTransformer extends AbstractTransformer {
|
||||
$mangaId = $item['relationships']['media']['data']['id'];
|
||||
$manga = $included['manga'][$mangaId];
|
||||
|
||||
$genres = array_column($manga['relationships']['genres'], 'name') ?? [];
|
||||
$genres = [];
|
||||
|
||||
foreach ($manga['relationships']['categories'] as $genre)
|
||||
{
|
||||
$genres[] = $genre['title'];
|
||||
}
|
||||
|
||||
sort($genres);
|
||||
|
||||
$rating = (int) $item['attributes']['ratingTwenty'] !== 0
|
||||
|
@ -35,12 +35,9 @@ final class MangaTransformer extends AbstractTransformer {
|
||||
{
|
||||
$genres = [];
|
||||
|
||||
foreach($item['included'] as $included)
|
||||
foreach($included['categories'] as $cat)
|
||||
{
|
||||
if ($included['type'] === 'categories')
|
||||
{
|
||||
$genres[] = $included['attributes']['title'];
|
||||
}
|
||||
$genres[] = $cat['title'];
|
||||
}
|
||||
|
||||
sort($genres);
|
||||
|
Loading…
Reference in New Issue
Block a user