get anime staff from GraphQL, see #27
This commit is contained in:
parent
50f3c394c5
commit
dcd138cba6
@ -53,6 +53,7 @@ query ($slug: String!) {
|
|||||||
endDate
|
endDate
|
||||||
episodeCount
|
episodeCount
|
||||||
episodeLength
|
episodeLength
|
||||||
|
totalLength
|
||||||
posterImage {
|
posterImage {
|
||||||
original {
|
original {
|
||||||
height
|
height
|
||||||
@ -107,7 +108,6 @@ query ($slug: String!) {
|
|||||||
status
|
status
|
||||||
synopsis
|
synopsis
|
||||||
titles {
|
titles {
|
||||||
alternatives
|
|
||||||
canonical
|
canonical
|
||||||
localized
|
localized
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,33 @@ final class AnimeTransformer extends AbstractTransformer {
|
|||||||
uasort($characters['supporting'], fn($a, $b) => $a['name'] <=> $b['name']);
|
uasort($characters['supporting'], fn($a, $b) => $a['name'] <=> $b['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($base['staff']['nodes']) > 0)
|
||||||
|
{
|
||||||
|
foreach ($base['staff']['nodes'] as $staffing)
|
||||||
|
{
|
||||||
|
$person = $staffing['person'];
|
||||||
|
$role = $staffing['role'];
|
||||||
|
$name = $person['names']['localized'][$person['names']['canonical']];
|
||||||
|
|
||||||
|
if ( ! array_key_exists($role, $staff))
|
||||||
|
{
|
||||||
|
$staff[$role] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$staff[$role][$person['id']] = [
|
||||||
|
'id' => $person['id'],
|
||||||
|
'name' => $name,
|
||||||
|
'image' => [
|
||||||
|
'original' => $person['image']['original']['url'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
usort($staff[$role], fn ($a, $b) => $a['name'] <=> $b['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($staff);
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'age_rating' => $base['ageRating'],
|
'age_rating' => $base['ageRating'],
|
||||||
'age_rating_guide' => $base['ageRatingGuide'],
|
'age_rating_guide' => $base['ageRatingGuide'],
|
||||||
|
Loading…
Reference in New Issue
Block a user