Skip to content

Commit aadd456

Browse files
Merge pull request #17256 from mauriciofauth/rel-params-refactor
Refactor `RelationParameters` class
2 parents ed8ebb3 + 0cf1843 commit aadd456

100 files changed

Lines changed: 2215 additions & 1653 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

libraries/classes/Bookmark.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ public static function getParams(string $user)
213213
}
214214

215215
$relation = new Relation($dbi);
216-
$relationParameters = $relation->getRelationParameters();
217-
if ($relationParameters->hasBookmarkFeature() && $relationParameters->db !== null) {
216+
$bookmarkFeature = $relation->getRelationParameters()->bookmarkFeature;
217+
if ($bookmarkFeature !== null) {
218218
$cfgBookmark = [
219219
'user' => $user,
220-
'db' => $relationParameters->db->getName(),
221-
'table' => $relationParameters->bookmark,
220+
'db' => $bookmarkFeature->database->getName(),
221+
'table' => $bookmarkFeature->bookmark->getName(),
222222
];
223223
Cache::set($cacheKey, $cfgBookmark);
224224

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class BookmarkFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $bookmark;
20+
21+
public function __construct(DatabaseName $database, TableName $bookmark)
22+
{
23+
$this->database = $database;
24+
$this->bookmark = $bookmark;
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class BrowserTransformationFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $columnInfo;
20+
21+
public function __construct(DatabaseName $database, TableName $columnInfo)
22+
{
23+
$this->database = $database;
24+
$this->columnInfo = $columnInfo;
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class CentralColumnsFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $centralColumns;
20+
21+
public function __construct(DatabaseName $database, TableName $centralColumns)
22+
{
23+
$this->database = $database;
24+
$this->centralColumns = $centralColumns;
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class ColumnCommentsFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $columnInfo;
20+
21+
public function __construct(DatabaseName $database, TableName $columnInfo)
22+
{
23+
$this->database = $database;
24+
$this->columnInfo = $columnInfo;
25+
}
26+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class ConfigurableMenusFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $userGroups;
20+
21+
/** @var TableName */
22+
public $users;
23+
24+
public function __construct(DatabaseName $database, TableName $userGroups, TableName $users)
25+
{
26+
$this->database = $database;
27+
$this->userGroups = $userGroups;
28+
$this->users = $users;
29+
}
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class DatabaseDesignerSettingsFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $designerSettings;
20+
21+
public function __construct(DatabaseName $database, TableName $designerSettings)
22+
{
23+
$this->database = $database;
24+
$this->designerSettings = $designerSettings;
25+
}
26+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class DisplayFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $relation;
20+
21+
/** @var TableName */
22+
public $tableInfo;
23+
24+
public function __construct(DatabaseName $database, TableName $relation, TableName $tableInfo)
25+
{
26+
$this->database = $database;
27+
$this->relation = $relation;
28+
$this->tableInfo = $tableInfo;
29+
}
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class ExportTemplatesFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $exportTemplates;
20+
21+
public function __construct(DatabaseName $database, TableName $exportTemplates)
22+
{
23+
$this->database = $database;
24+
$this->exportTemplates = $exportTemplates;
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpMyAdmin\ConfigStorage\Features;
6+
7+
use PhpMyAdmin\Dbal\DatabaseName;
8+
use PhpMyAdmin\Dbal\TableName;
9+
10+
/**
11+
* @psalm-immutable
12+
*/
13+
final class FavoriteTablesFeature
14+
{
15+
/** @var DatabaseName */
16+
public $database;
17+
18+
/** @var TableName */
19+
public $favorite;
20+
21+
public function __construct(DatabaseName $database, TableName $favorite)
22+
{
23+
$this->database = $database;
24+
$this->favorite = $favorite;
25+
}
26+
}

0 commit comments

Comments
 (0)