Remove getRelationsAndStatus

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2024-09-20 19:14:09 +01:00
parent 6a93167d39
commit cd3e481642
8 changed files with 19 additions and 60 deletions

View File

@ -9822,7 +9822,7 @@ parameters:
-
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
count: 2
count: 1
path: src/Plugins/Export/ExportSql.php
-
@ -9850,16 +9850,6 @@ parameters:
count: 2
path: src/Plugins/Export/ExportSql.php
-
message: "#^Cannot access offset 'foreign_field' on mixed\\.$#"
count: 1
path: src/Plugins/Export/ExportSql.php
-
message: "#^Cannot access offset 'foreign_table' on mixed\\.$#"
count: 1
path: src/Plugins/Export/ExportSql.php
-
message: "#^Cannot access offset 'index_list' on mixed\\.$#"
count: 1

View File

@ -1532,25 +1532,6 @@ class Relation
$this->getRelationParameters();
}
/**
* Gets the relations info and status, depending on the condition
*
* @param bool $condition whether to look for foreigners or not
* @param string $db database name
* @param string $table table name
*
* @return mixed[]
*/
public function getRelationsAndStatus(bool $condition, string $db, string $table): array
{
if ($condition) {
// Find which tables are related with the current one and write it in an array
return $this->getForeigners($db, $table);
}
return [];
}
/**
* Verifies that all pmadb features are disabled
*/

View File

@ -50,11 +50,9 @@ final class DataDictionaryController implements InvocableController
$this->dbi->getTableIndexes(Current::$database, $tableName),
);
$foreigners = $this->relation->getRelationsAndStatus(
$relationParameters->relationFeature !== null,
Current::$database,
$tableName,
);
$foreigners = $relationParameters->relationFeature !== null
? $this->relation->getForeigners(Current::$database, $tableName)
: [];
$columnsComments = $this->relation->getComments(Current::$database, $tableName);

View File

@ -336,11 +336,9 @@ class ExportHtmlword extends ExportPlugin
$dbi->selectDb($db);
// Check if we can use Relations
$foreigners = $this->relation->getRelationsAndStatus(
$doRelation && $relationParameters->relationFeature !== null,
$db,
$table,
);
$foreigners = $doRelation && $relationParameters->relationFeature !== null
? $this->relation->getForeigners($db, $table)
: [];
/**
* Displays the table structure

View File

@ -473,11 +473,9 @@ class ExportLatex extends ExportPlugin
$dbi->selectDb($db);
// Check if we can use Relations
$foreigners = $this->relation->getRelationsAndStatus(
$doRelation && $relationParameters->relationFeature !== null,
$db,
$table,
);
$foreigners = $doRelation && $relationParameters->relationFeature !== null ?
$this->relation->getForeigners($db, $table)
: [];
/**
* Displays the table structure
*/

View File

@ -423,11 +423,9 @@ class ExportOdt extends ExportPlugin
$dbi->selectDb($db);
// Check if we can use Relations
$foreigners = $this->relation->getRelationsAndStatus(
$doRelation && $relationParameters->relationFeature !== null,
$db,
$table,
);
$foreigners = $doRelation && $relationParameters->relationFeature !== null ?
$this->relation->getForeigners($db, $table)
: [];
/**
* Displays the table structure
*/

View File

@ -1747,11 +1747,9 @@ class ExportSql extends ExportPlugin
$schemaCreate = '';
// Check if we can use Relations
$foreigners = $this->relation->getRelationsAndStatus(
$doRelation && $relationParameters->relationFeature !== null,
$db,
$table,
);
$foreigners = $doRelation && $relationParameters->relationFeature !== null ?
$this->relation->getForeigners($db, $table)
: [];
$mimeMap = null;
if ($doMime && $relationParameters->browserTransformationFeature !== null) {

View File

@ -352,11 +352,9 @@ class ExportTexytext extends ExportPlugin
$dbi->selectDb($db);
// Check if we can use Relations
$foreigners = $this->relation->getRelationsAndStatus(
$doRelation && $relationParameters->relationFeature !== null,
$db,
$table,
);
$foreigners = $doRelation && $relationParameters->relationFeature !== null ?
$this->relation->getForeigners($db, $table)
: [];
/**
* Displays the table structure