Skip to content

Commit 1b10901

Browse files
committed
removed extra added param according to PR comment
1 parent d9f3e54 commit 1b10901

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ public function __construct(
6767

6868
/**
6969
* @inheritdoc
70-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
7170
*/
72-
public function build(Schema $schema, $tablesWithJsonTypeField = [])
71+
public function build(Schema $schema)
7372
{
7473
foreach ($this->sharding->getResources() as $resource) {
7574
foreach ($this->dbSchemaReader->readTables($resource) as $tableName) {
@@ -97,6 +96,7 @@ public function build(Schema $schema, $tablesWithJsonTypeField = [])
9796
]
9897
);
9998
$isJsonType = false;
99+
$tablesWithJsonTypeField = $schema->getTablesWithJsonTypeField();
100100
if (count($tablesWithJsonTypeField) > 0 && isset($tablesWithJsonTypeField[$tableName])) {
101101
$isJsonType = true;
102102
}

lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Schema.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class Schema
1818
{
1919
/**
20-
* Resource connection.
20+
* Get resource connection.
2121
*
2222
* @var ResourceConnection
2323
*/
@@ -30,6 +30,13 @@ class Schema
3030
*/
3131
private $tables;
3232

33+
/**
34+
* declared tables.
35+
*
36+
* @var array
37+
*/
38+
private $tablesWithJsonTypeField;
39+
3340
/**
3441
* Schema constructor.
3542
*
@@ -76,4 +83,25 @@ public function getTableByName($name)
7683
$name = $this->resourceConnection->getTableName($name);
7784
return $this->tables[$name] ?? false;
7885
}
86+
87+
/**
88+
* Get tables name with JSON type fields.
89+
*
90+
* @return array
91+
*/
92+
public function getTablesWithJsonTypeField(): array
93+
{
94+
return $this->tablesWithJsonTypeField;
95+
}
96+
97+
/**
98+
* Set tables name with JSON type fields.
99+
*
100+
* @param array $tablesWithJsonTypeField
101+
* @return array
102+
*/
103+
public function setTablesWithJsonTypeField(array $tablesWithJsonTypeField): array
104+
{
105+
return $this->tablesWithJsonTypeField = $tablesWithJsonTypeField;
106+
}
79107
}

lib/internal/Magento/Framework/Setup/Declaration/Schema/SchemaConfig.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ public function getDbConfig()
7272
}
7373
}
7474
$schema = $this->schemaFactory->create();
75-
$schema = $this->dbSchemaBuilder->build($schema, $tablesWithJsonTypeField);
75+
$schema->setTablesWithJsonTypeField($tablesWithJsonTypeField);
76+
$schema = $this->dbSchemaBuilder->build($schema);
7677
return $schema;
7778
}
7879

0 commit comments

Comments
 (0)