Skip to content

Commit d6b614f

Browse files
committed
MAGETWO-95595: Index names are ignored by declarative schema
1 parent b9af73a commit d6b614f

File tree

4 files changed

+19
-21
lines changed

4 files changed

+19
-21
lines changed

app/code/Magento/Developer/Console/Command/TablesWhitelistGenerateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
7979
try {
8080
$this->whitelistGenerator->generate($moduleName);
8181
} catch (ConfigurationMismatchException $e) {
82-
$output->writeln("<info>". $e . "</info>");
82+
$output->writeln($e->getMessage());
8383
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
8484
} catch (\Exception $e) {
8585
return \Magento\Framework\Console\Cli::RETURN_FAILURE;

app/code/Magento/Developer/Model/Setup/Declaration/Schema/WhitelistGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private function persistModule(Schema $schema, string $moduleName)
161161
}
162162

163163
/**
164-
* Provides immutable names of the table elements.
164+
* Provide immutable names of the table elements.
165165
*
166166
* @param array $tableData
167167
* @return array
@@ -177,7 +177,7 @@ private function getElementsWithFixedName(array $tableData): array
177177
}
178178

179179
/**
180-
* Provides autogenerated names of the table elements.
180+
* Provide autogenerated names of the table elements.
181181
*
182182
* @param Schema $schema
183183
* @param string $tableName

lib/internal/Magento/Framework/Setup/Declaration/Schema/Config/Converter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function recursiveConvert(\Traversable $source): array
7575
}
7676

7777
/**
78-
* Provides the value of the ID attribute for each element.
78+
* Provide the value of the ID attribute for each element.
7979
*
8080
* @param \DOMElement $element
8181
* @return string

lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/TableElement/ElementNameResolver.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Magento\Framework\Setup\Declaration\Schema\TableNameResolver;
1515

1616
/**
17-
* Provides names of table elements with autogenerated names.
17+
* Provide names of table elements with autogenerated names.
1818
*/
1919
class ElementNameResolver
2020
{
@@ -39,7 +39,7 @@ public function __construct(TableNameResolver $tableNameResolver, ResourceConnec
3939
}
4040

4141
/**
42-
* Provides the full index name based on the prefix value.
42+
* Provide the full index name based on the prefix value.
4343
*
4444
* @param Table $table
4545
* @param string[] $columns
@@ -59,12 +59,11 @@ public function getFullIndexName(
5959
* Temporary solution.
6060
* @see MAGETWO-91365
6161
*/
62-
if ($type
63-
&& !array_search(
64-
$type,
65-
[AdapterInterface::INDEX_TYPE_FULLTEXT, AdapterInterface::INDEX_TYPE_UNIQUE]
66-
)
67-
) {
62+
$isIndexTypeOutOfList = false === array_search(
63+
$type,
64+
[AdapterInterface::INDEX_TYPE_FULLTEXT, AdapterInterface::INDEX_TYPE_UNIQUE]
65+
);
66+
if ($type && $isIndexTypeOutOfList) {
6867
$type = AdapterInterface::INDEX_TYPE_INDEX;
6968
}
7069

@@ -79,7 +78,7 @@ public function getFullIndexName(
7978
}
8079

8180
/**
82-
* Provides the index name without prefix value.
81+
* Provide the index name without prefix value.
8382
*
8483
* @param string $name
8584
* @param Table $table
@@ -104,12 +103,11 @@ public function getIndexNameWithoutPrefix(
104103
* Temporary solution.
105104
* @see MAGETWO-91365
106105
*/
107-
if ($type
108-
&& !array_search(
109-
$type,
110-
[AdapterInterface::INDEX_TYPE_FULLTEXT, AdapterInterface::INDEX_TYPE_UNIQUE]
111-
)
112-
) {
106+
$isIndexTypeOutOfList = false === array_search(
107+
$type,
108+
[AdapterInterface::INDEX_TYPE_FULLTEXT, AdapterInterface::INDEX_TYPE_UNIQUE]
109+
);
110+
if ($type && $isIndexTypeOutOfList) {
113111
$type = AdapterInterface::INDEX_TYPE_INDEX;
114112
}
115113

@@ -128,7 +126,7 @@ public function getIndexNameWithoutPrefix(
128126
}
129127

130128
/**
131-
* Provides the full foreign key name based on the prefix value.
129+
* Provide the full foreign key name based on the prefix value.
132130
*
133131
* @param Table $table
134132
* @param Column $column
@@ -154,7 +152,7 @@ public function getFullFKName(
154152
}
155153

156154
/**
157-
* Provides the foreign key name without prefix value.
155+
* Provide the foreign key name without prefix value.
158156
*
159157
* @param string $name
160158
* @param Table $table

0 commit comments

Comments
 (0)