diff --git a/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php b/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php index 8a006c8154b4b..be33e94b1e306 100644 --- a/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php +++ b/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php @@ -20,6 +20,7 @@ use Magento\Deploy\Model\DeployManager; use Magento\Framework\App\Cache; use Magento\Framework\App\Cache\Type\Dummy as DummyCache; +use Magento\Framework\ObjectManager\ConfigInterface; /** * Deploy static content command @@ -82,22 +83,30 @@ class DeployStaticContentCommand extends Command /** @var \Magento\Framework\App\State */ private $appState; + /** + * @var \Magento\Framework\ObjectManager\ConfigInterface $config + */ + protected $config; + /** * Inject dependencies * * @param ObjectManagerFactory $objectManagerFactory * @param Locale $validator * @param ObjectManagerInterface $objectManager + * @param ConfigInterface $config * @throws \LogicException When the command name is empty */ public function __construct( ObjectManagerFactory $objectManagerFactory, Locale $validator, - ObjectManagerInterface $objectManager + ObjectManagerInterface $objectManager, + ConfigInterface $config ) { $this->objectManagerFactory = $objectManagerFactory; $this->validator = $validator; $this->objectManager = $objectManager; + $this->config = $config; parent::__construct(); } @@ -490,10 +499,17 @@ private function prepareDeployableEntities($filesUtil) */ private function mockCache() { + $preferences = $this->config->getPreferences(); + $instanceTypes = $this->config->getVirtualTypes(); + $arguments = $this->config->getAllArguments(); + + //Swap out the cache class and maintain current preferences/instance types/arguments + $preferences[Cache::class] = DummyCache::class; + $this->objectManager->configure([ - 'preferences' => [ - Cache::class => DummyCache::class - ] + 'preferences' => $preferences, + 'arguments' => $arguments, + 'instanceTypes' => $instanceTypes ]); } } diff --git a/app/code/Magento/Deploy/Console/Command/DeployStaticOptionsInterface.php b/app/code/Magento/Deploy/Console/Command/DeployStaticOptionsInterface.php index 25457f5505fb9..72287fd5d0dab 100644 --- a/app/code/Magento/Deploy/Console/Command/DeployStaticOptionsInterface.php +++ b/app/code/Magento/Deploy/Console/Command/DeployStaticOptionsInterface.php @@ -84,7 +84,7 @@ interface DeployStaticOptionsInterface const EXCLUDE_AREA = 'exclude-area'; /** - * Jey for jobs option + * Key for jobs option */ const JOBS_AMOUNT = 'jobs'; diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/ConfigTesting.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/ConfigTesting.php index 75cf91138f012..c3e7ad2a26a97 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/ConfigTesting.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/Environment/ConfigTesting.php @@ -96,6 +96,16 @@ public function getVirtualTypes() return []; } + /** + * Returns entire arguments keyed by type + * + * @return array + */ + public function getAllArguments() + { + return []; + } + /** * Extend configuration * diff --git a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php index a3ed3b941844e..6b557a0c3d173 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php +++ b/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php @@ -153,4 +153,14 @@ public function getPreferences() { return $this->preferences; } + + /** + * Returns list on preferences + * + * @return array + */ + public function getAllArguments() + { + return $this->arguments; + } } diff --git a/lib/internal/Magento/Framework/ObjectManager/Config/Config.php b/lib/internal/Magento/Framework/ObjectManager/Config/Config.php index 5dc02e6ba7d97..4c3661b83a0a3 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Config/Config.php +++ b/lib/internal/Magento/Framework/ObjectManager/Config/Config.php @@ -323,4 +323,14 @@ public function getPreferences() { return $this->_preferences; } + + /** + * Returns list on preferences + * + * @return array + */ + public function getAllArguments() + { + return $this->_arguments; + } } diff --git a/lib/internal/Magento/Framework/ObjectManager/ConfigInterface.php b/lib/internal/Magento/Framework/ObjectManager/ConfigInterface.php index df6fa91c3fcae..295fbbd896b38 100644 --- a/lib/internal/Magento/Framework/ObjectManager/ConfigInterface.php +++ b/lib/internal/Magento/Framework/ObjectManager/ConfigInterface.php @@ -33,6 +33,13 @@ public function setCache(ConfigCacheInterface $cache); */ public function getArguments($type); + /** + * Returns entire arguments keyed by type + * + * @return array + */ + public function getAllArguments(); + /** * Check whether type is shared *