77
88namespace PhpMyAdmin \Plugins \Schema \Pdf ;
99
10+ use PhpMyAdmin \Dbal \DatabaseName ;
1011use PhpMyAdmin \Pdf as PdfLib ;
1112use PhpMyAdmin \Plugins \Schema \ExportRelationSchema ;
1213use PhpMyAdmin \Transformations ;
@@ -99,11 +100,9 @@ class PdfRelationSchema extends ExportRelationSchema
99100 private Transformations $ transformations ;
100101
101102 /**
102- * @see Schema\Pdf
103- *
104- * @param string $db database name
103+ * @see Pdf
105104 */
106- public function __construct ($ db )
105+ public function __construct (DatabaseName $ db )
107106 {
108107 $ this ->transformations = new Transformations ();
109108
@@ -126,13 +125,13 @@ public function __construct($db)
126125 $ this ->paper ,
127126 $ this ->pageNumber ,
128127 $ this ->withDoc ,
129- $ db
128+ $ db-> getName ()
130129 )
131130 );
132131 $ this ->diagram ->setTitle (
133132 sprintf (
134133 __ ('Schema of the %s database ' ),
135- $ this ->db
134+ $ this ->db -> getName ()
136135 )
137136 );
138137 $ this ->diagram ->setCMargin (0 );
@@ -170,7 +169,7 @@ public function __construct($db)
170169 if (! isset ($ this ->tables [$ table ])) {
171170 $ this ->tables [$ table ] = new TableStatsPdf (
172171 $ this ->diagram ,
173- $ this ->db ,
172+ $ this ->db -> getName () ,
174173 $ table ,
175174 null ,
176175 $ this ->pageNumber ,
@@ -215,7 +214,7 @@ public function __construct($db)
215214 // and finding its foreigns is OK (then we can support innodb)
216215 $ seen_a_relation = false ;
217216 foreach ($ alltables as $ one_table ) {
218- $ exist_rel = $ this ->relation ->getForeigners ($ this ->db , $ one_table , '' , 'both ' );
217+ $ exist_rel = $ this ->relation ->getForeigners ($ this ->db -> getName () , $ one_table , '' , 'both ' );
219218 if (! $ exist_rel ) {
220219 continue ;
221220 }
@@ -354,7 +353,7 @@ private function addRelation(
354353 if (! isset ($ this ->tables [$ masterTable ])) {
355354 $ this ->tables [$ masterTable ] = new TableStatsPdf (
356355 $ this ->diagram ,
357- $ this ->db ,
356+ $ this ->db -> getName () ,
358357 $ masterTable ,
359358 null ,
360359 $ this ->pageNumber ,
@@ -368,7 +367,7 @@ private function addRelation(
368367 if (! isset ($ this ->tables [$ foreignTable ])) {
369368 $ this ->tables [$ foreignTable ] = new TableStatsPdf (
370369 $ this ->diagram ,
371- $ this ->db ,
370+ $ this ->db -> getName () ,
372371 $ foreignTable ,
373372 null ,
374373 $ this ->pageNumber ,
@@ -509,7 +508,7 @@ public function dataDictionaryDoc(array $alltables): void
509508 $ this ->diagram ->customLinks ['doc ' ][$ table ]['- ' ]
510509 );
511510 // $this->diagram->Ln(1);
512- $ fields = $ GLOBALS ['dbi ' ]->getColumns ($ this ->db , $ table );
511+ $ fields = $ GLOBALS ['dbi ' ]->getColumns ($ this ->db -> getName () , $ table );
513512 foreach ($ fields as $ row ) {
514513 $ this ->diagram ->setX (20 );
515514 $ field_name = $ row ['Field ' ];
@@ -569,15 +568,15 @@ public function dataDictionaryDoc(array $alltables): void
569568 $ this ->diagram ->Ln ();
570569
571570 $ relationParameters = $ this ->relation ->getRelationParameters ();
572- $ comments = $ this ->relation ->getComments ($ this ->db , $ table );
571+ $ comments = $ this ->relation ->getComments ($ this ->db -> getName () , $ table );
573572 if ($ relationParameters ->browserTransformationFeature !== null ) {
574- $ mime_map = $ this ->transformations ->getMime ($ this ->db , $ table , true );
573+ $ mime_map = $ this ->transformations ->getMime ($ this ->db -> getName () , $ table , true );
575574 }
576575
577576 /**
578577 * Gets table information
579578 */
580- $ showtable = $ GLOBALS ['dbi ' ]->getTable ($ this ->db , $ table )
579+ $ showtable = $ GLOBALS ['dbi ' ]->getTable ($ this ->db -> getName () , $ table )
581580 ->getStatusInfo ();
582581 $ show_comment = $ showtable ['Comment ' ] ?? '' ;
583582 $ create_time = isset ($ showtable ['Create_time ' ])
@@ -599,11 +598,11 @@ public function dataDictionaryDoc(array $alltables): void
599598 /**
600599 * Gets fields properties
601600 */
602- $ columns = $ GLOBALS ['dbi ' ]->getColumns ($ this ->db , $ table );
601+ $ columns = $ GLOBALS ['dbi ' ]->getColumns ($ this ->db -> getName () , $ table );
603602
604603 // Find which tables are related with the current one and write it in
605604 // an array
606- $ res_rel = $ this ->relation ->getForeigners ($ this ->db , $ table );
605+ $ res_rel = $ this ->relation ->getForeigners ($ this ->db -> getName () , $ table );
607606
608607 /**
609608 * Displays the comments of the table if MySQL >= 3.23
@@ -729,7 +728,7 @@ public function dataDictionaryDoc(array $alltables): void
729728 $ linksTo = '' ;
730729 if ($ foreigner ) {
731730 $ linksTo = '-> ' ;
732- if ($ foreigner ['foreign_db ' ] != $ this ->db ) {
731+ if ($ foreigner ['foreign_db ' ] != $ this ->db -> getName () ) {
733732 $ linksTo .= $ foreigner ['foreign_db ' ] . '. ' ;
734733 }
735734
0 commit comments