Skip to content

Commit a8fbac0

Browse files
committed
ACP2E-3709: [Cloud] Changing table column type from Int to Decimal using db_schema.xml file In Magento 2 Results In Errors
1 parent d94e0a1 commit a8fbac0

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

lib/internal/Magento/Framework/Config/Reader/Filesystem.php

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Filesystem implements \Magento\Framework\Config\ReaderInterface
8686
*
8787
* @var string
8888
*/
89-
protected $_typeAttributeName;
89+
private $typeAttributeName;
9090

9191
/**
9292
* Constructor
@@ -110,7 +110,7 @@ public function __construct(
110110
$idAttributes = [],
111111
$domDocumentClass = \Magento\Framework\Config\Dom::class,
112112
$defaultScope = 'global',
113-
$typeAttributeName = null,
113+
?string $typeAttributeName = null,
114114
) {
115115
$this->_fileResolver = $fileResolver;
116116
$this->_converter = $converter;
@@ -122,7 +122,7 @@ public function __construct(
122122
? $schemaLocator->getPerFileSchema() : null;
123123
$this->_domDocumentClass = $domDocumentClass;
124124
$this->_defaultScope = $defaultScope;
125-
$this->_typeAttributeName = $typeAttributeName;
125+
$this->typeAttributeName = $typeAttributeName;
126126
}
127127

128128
/**
@@ -158,9 +158,6 @@ protected function _readFiles($fileList)
158158
foreach ($fileList as $key => $content) {
159159
try {
160160
if (!$configMerger) {
161-
if ($this->isDbSchemaFile($key)) {
162-
$this->_typeAttributeName = 'xsi:type';
163-
}
164161
$configMerger = $this->_createConfigMerger($this->_domDocumentClass, $content);
165162
} else {
166163
$configMerger->merge($content);
@@ -184,9 +181,6 @@ protected function _readFiles($fileList)
184181
$configMerger = null;
185182
foreach ($fileList as $key => $content) {
186183
if (!$configMerger) {
187-
if ($this->isDbSchemaFile($key)) {
188-
$this->_typeAttributeName = 'xsi:type';
189-
}
190184
$configMerger = $this->_createConfigMerger($this->_domDocumentClass, $content);
191185
} else {
192186
$configMerger->merge($content);
@@ -226,7 +220,7 @@ protected function _createConfigMerger($mergerClass, $initialContents)
226220
$initialContents,
227221
$this->validationState,
228222
$this->_idAttributes,
229-
$this->_typeAttributeName,
223+
$this->typeAttributeName,
230224
$this->_perFileSchema
231225
);
232226
if (!$result instanceof \Magento\Framework\Config\Dom) {
@@ -236,17 +230,4 @@ protected function _createConfigMerger($mergerClass, $initialContents)
236230
}
237231
return $result;
238232
}
239-
240-
/**
241-
* Check schema file, return true if it is db_schema.xml
242-
*
243-
* @param string $filePath
244-
* @return bool
245-
*/
246-
private function isDbSchemaFile(string $filePath): bool
247-
{
248-
// Check only if "db_schema.xml" is at the very end of the path
249-
$pattern = '/db_schema\.xml$/';
250-
return preg_match($pattern, $filePath) === 1;
251-
}
252233
}

0 commit comments

Comments
 (0)