Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
ModuleUninstaller Class Reference

Public Member Functions

 __construct (ObjectManagerProvider $objectManagerProvider, \Magento\Framework\Composer\Remove $remove, UninstallCollector $collector, \Magento\Setup\Module\SetupFactory $setupFactory)
 
 uninstallData (OutputInterface $output, array $modules)
 

Detailed Description

Class to uninstall a module component

Definition at line 14 of file ModuleUninstaller.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ObjectManagerProvider  $objectManagerProvider,
\Magento\Framework\Composer\Remove  $remove,
UninstallCollector  $collector,
\Magento\Setup\Module\SetupFactory  $setupFactory 
)

Constructor

Parameters
ObjectManagerProvider$objectManagerProvider
\Magento\Framework\Composer\Remove$remove
UninstallCollector$collector
\Magento\Setup\Module\SetupFactory$setupFactory
PatchApplier$patchApplier

Definition at line 49 of file ModuleUninstaller.php.

54  {
55  $this->objectManager = $objectManagerProvider->get();
56  $this->remove = $remove;
57  $this->collector = $collector;
58  $this->setupFactory = $setupFactory;
59  }

Member Function Documentation

◆ uninstallData()

uninstallData ( OutputInterface  $output,
array  $modules 
)

Invoke remove data routine in each specified module

Parameters
OutputInterface$output
array$modules
Returns
void

Definition at line 80 of file ModuleUninstaller.php.

81  {
82  $uninstalls = $this->collector->collectUninstall($modules);
83  $setupModel = $this->setupFactory->create();
84  $resource = $this->objectManager->get(\Magento\Framework\Module\ModuleResource::class);
85  foreach ($modules as $module) {
86  if (isset($uninstalls[$module])) {
87  $output->writeln("<info>Removing data of $module</info>");
88  $uninstalls[$module]->uninstall(
89  $setupModel,
90  new ModuleContext($resource->getDbVersion($module) ?: '')
91  );
92  }
93 
94  $this->getPatchApplier()->revertDataPatches($module);
95  }
96  }
$resource
Definition: bulk.php:12

The documentation for this class was generated from the following file: