Skip to content

Commit 9532286

Browse files
committed
Fix notices in deploy static content deploy
Notice: Undefined index: arguments in /src/magento2/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php on line 132 Notice: Undefined index: instanceTypes in /src/magento2/lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php on line 133
1 parent bc9df94 commit 9532286

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Deploy\Model\DeployManager;
2121
use Magento\Framework\App\Cache;
2222
use Magento\Framework\App\Cache\Type\Dummy as DummyCache;
23+
use Magento\Framework\ObjectManager\ConfigInterface;
2324

2425
/**
2526
* Deploy static content command
@@ -82,6 +83,11 @@ class DeployStaticContentCommand extends Command
8283
/** @var \Magento\Framework\App\State */
8384
private $appState;
8485

86+
/**
87+
* @var \Magento\Framework\ObjectManager\ConfigInterface $config
88+
*/
89+
protected $config;
90+
8591
/**
8692
* Inject dependencies
8793
*
@@ -93,11 +99,13 @@ class DeployStaticContentCommand extends Command
9399
public function __construct(
94100
ObjectManagerFactory $objectManagerFactory,
95101
Locale $validator,
96-
ObjectManagerInterface $objectManager
102+
ObjectManagerInterface $objectManager,
103+
ConfigInterface $config
97104
) {
98105
$this->objectManagerFactory = $objectManagerFactory;
99106
$this->validator = $validator;
100107
$this->objectManager = $objectManager;
108+
$this->config = $config;
101109

102110
parent::__construct();
103111
}
@@ -490,10 +498,17 @@ private function prepareDeployableEntities($filesUtil)
490498
*/
491499
private function mockCache()
492500
{
501+
$preferences = $this->config->getPreferences();
502+
$instanceTypes = $this->config->getVirtualTypes();
503+
$arguments = $this->config->getAllArguments();
504+
505+
//Swap out the cache class and maintain current preferences/instance types/arguments
506+
$preferences[Cache::class] = DummyCache::class;
507+
493508
$this->objectManager->configure([
494-
'preferences' => [
495-
Cache::class => DummyCache::class
496-
]
509+
'preferences' => $preferences,
510+
'arguments' => $arguments,
511+
'instanceTypes' => $instanceTypes
497512
]);
498513
}
499514
}

lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,14 @@ public function getPreferences()
153153
{
154154
return $this->preferences;
155155
}
156+
157+
/**
158+
* Returns list on preferences
159+
*
160+
* @return array
161+
*/
162+
public function getAllArguments()
163+
{
164+
return $this->arguments;
165+
}
156166
}

lib/internal/Magento/Framework/ObjectManager/Config/Config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,14 @@ public function getPreferences()
323323
{
324324
return $this->_preferences;
325325
}
326+
327+
/**
328+
* Returns list on preferences
329+
*
330+
* @return array
331+
*/
332+
public function getAllArguments()
333+
{
334+
return $this->_arguments;
335+
}
326336
}

lib/internal/Magento/Framework/ObjectManager/ConfigInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ public function setCache(ConfigCacheInterface $cache);
3333
*/
3434
public function getArguments($type);
3535

36+
/**
37+
* Returns entire arguments keyed by type
38+
*
39+
* @return array
40+
*/
41+
public function getAllArguments();
42+
3643
/**
3744
* Check whether type is shared
3845
*

0 commit comments

Comments
 (0)