@@ -96,12 +96,17 @@ public function getLocalGameData(): ?array
9696 $ downloadsQuery ->execute ([$ next ['id ' ]]);
9797 $ downloads = $ downloadsQuery ->fetchAll (PDO ::FETCH_ASSOC );
9898
99+ $ extrasQuery = $ pdo ->prepare ('select * from game_extras where game_id = ? ' );
100+ $ extrasQuery ->execute ([$ next ['id ' ]]);
101+ $ extras = $ extrasQuery ->fetchAll (PDO ::FETCH_ASSOC );
102+
99103 $ result [] = $ this ->serializer ->deserialize ([
100104 'id ' => $ next ['game_id ' ],
101105 'title ' => $ next ['title ' ],
102106 'cdKey ' => $ next ['cd_key ' ] ?? '' ,
103107 'downloads ' => $ downloads ,
104108 'slug ' => $ next ['slug ' ] ?? '' ,
109+ 'extras ' => $ extras ,
105110 ], GameDetail::class);
106111 }
107112
@@ -145,6 +150,23 @@ public function storeSingleGameDetail(GameDetail $detail): void
145150 $ download ->gogGameId ,
146151 ]);
147152 }
153+ foreach ($ detail ->extras as $ extra ) {
154+ $ pdo ->prepare ('insert into game_extras (extra_id, name, size, url, gog_game_id, game_id)
155+ values (?, ?, ?, ?, ?, ?)
156+ on conflict (extra_id) do update set name = excluded.name,
157+ size = excluded.size,
158+ url = excluded.url,
159+ gog_game_id = excluded.gog_game_id,
160+ game_id = excluded.game_id
161+ ' )->execute ([
162+ $ extra ->id ,
163+ $ extra ->name ,
164+ $ extra ->size ,
165+ $ extra ->url ,
166+ $ extra ->gogGameId ,
167+ $ id ,
168+ ]);
169+ }
148170 }
149171
150172 public function storeSetting (Setting $ setting , float |bool |int |string |null $ value ): void
0 commit comments