File tree Expand file tree Collapse file tree
Controllers/Database/Structure Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121use PhpMyAdmin \Util ;
2222
2323use function __ ;
24- use function array_map ;
2524use function count ;
2625use function json_decode ;
2726use function json_encode ;
@@ -114,10 +113,7 @@ public function __invoke(ServerRequest $request): void
114113 }
115114 }
116115
117- $ favoriteTables [$ user ] = array_map (
118- static fn (RecentFavoriteTable $ table ) => $ table ->toArray (),
119- $ favoriteInstance ->getTables (),
120- );
116+ $ favoriteTables [$ user ] = $ favoriteInstance ->getTables ();
121117
122118 $ json = [];
123119 $ json ['changes ' ] = $ changes ;
@@ -174,10 +170,7 @@ private function synchronizeFavoriteTables(
174170 }
175171 }
176172
177- $ favoriteTables [$ user ] = array_map (
178- static fn (RecentFavoriteTable $ table ) => $ table ->toArray (),
179- $ favoriteInstance ->getTables (),
180- );
173+ $ favoriteTables [$ user ] = $ favoriteInstance ->getTables ();
181174
182175 // Set flag when localStorage and pmadb(if present) are in sync.
183176 $ _SESSION ['tmpval ' ]['favorites_synced ' ][$ GLOBALS ['server ' ]] = true ;
Original file line number Diff line number Diff line change 44
55namespace PhpMyAdmin \Favorites ;
66
7+ use JsonSerializable ;
78use PhpMyAdmin \Identifiers \DatabaseName ;
89use PhpMyAdmin \Identifiers \TableName ;
910
10- final class RecentFavoriteTable
11+ final class RecentFavoriteTable implements JsonSerializable
1112{
1213 public function __construct (public readonly DatabaseName $ db , public readonly TableName $ table )
1314 {
@@ -24,4 +25,12 @@ public function toArray(): array
2425 {
2526 return ['db ' => $ this ->db ->getName (), 'table ' => $ this ->table ->getName ()];
2627 }
28+
29+ public function jsonSerialize (): mixed
30+ {
31+ return [
32+ 'db ' => $ this ->db ->getName (),
33+ 'table ' => $ this ->table ->getName (),
34+ ];
35+ }
2736}
Original file line number Diff line number Diff line change @@ -203,14 +203,14 @@ public function getHtmlList(): string
203203 $ tables = [];
204204 foreach ($ this ->tables as $ table ) {
205205 $ removeParameters = [
206- 'db ' => $ table ->db ,
206+ 'db ' => $ table ->db ->getName (),
207+ 'favorite_table ' => $ table ->table ->getName (),
207208 'ajax_request ' => true ,
208- 'favorite_table ' => $ table ->table ,
209209 'remove_favorite ' => true ,
210210 ];
211211 $ tableParameters = [
212- 'db ' => $ table ->db ,
213- 'table ' => $ table ->table ,
212+ 'db ' => $ table ->db -> getName () ,
213+ 'table ' => $ table ->table -> getName () ,
214214 'md5 ' => md5 ($ table ->db . '. ' . $ table ->table ),
215215 ];
216216
You can’t perform that action at this time.
0 commit comments