Skip to content

Commit 49b0d16

Browse files
author
Igor Melnikov
committed
MAGETWO-67871: Requesting autogenerated classes that are not in constructor cause fatal errors in production mode
- add factory generation for setup application
1 parent 8635ba4 commit 49b0d16

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

setup/src/Magento/Setup/Console/Command/DiCompileCommand.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
132132

133133
$modulePaths = $this->componentRegistrar->getPaths(ComponentRegistrar::MODULE);
134134
$libraryPaths = $this->componentRegistrar->getPaths(ComponentRegistrar::LIBRARY);
135+
$setupPath = $this->directoryList->getPath(DirectoryList::SETUP);
135136
$generationPath = $this->directoryList->getPath(DirectoryList::GENERATED_CODE);
136137

137138
$this->objectManager->get(\Magento\Framework\App\Cache::class)->clean();
138139
$compiledPathsList = [
139140
'application' => $modulePaths,
140141
'library' => $libraryPaths,
142+
'setup' => $setupPath,
141143
'generated_helpers' => $generationPath
142144
];
145+
143146
$this->excludedPathsList = [
144147
'application' => $this->getExcludedModulePaths($modulePaths),
145148
'framework' => $this->getExcludedLibraryPaths($libraryPaths),
149+
'setup' => $this->getExcludedSetupPaths($setupPath),
146150
];
147151
$this->configureObjectManager($output);
148152

@@ -247,6 +251,19 @@ private function getExcludedLibraryPaths(array $libraryPaths)
247251
return $excludedLibraryPaths;
248252
}
249253

254+
/**
255+
* Get excluded setup application paths
256+
*
257+
* @param string $setupPath
258+
* @return string[]
259+
*/
260+
private function getExcludedSetupPaths($setupPath)
261+
{
262+
return [
263+
'#^(?:' . $setupPath . ')(/[\\w]+)*/Test#'
264+
];
265+
}
266+
250267
/**
251268
* Delete directories by their code from "var" directory
252269
*
@@ -331,6 +348,7 @@ private function getOperationsConfiguration(
331348
'paths' => [
332349
$compiledPathsList['application'],
333350
$compiledPathsList['library'],
351+
$compiledPathsList['setup'],
334352
$compiledPathsList['generated_helpers'],
335353
],
336354
'filePatterns' => ['php' => '/\.php$/'],

0 commit comments

Comments
 (0)