I'm working on a solution that requires adding a bit of functionality to the magento installation process. How do I override a file in root/setup/src/Magento/...
How would i override setup/src/Magento/Setup/Model/Installer.php
?
I am not sure you can do this in Magento directly. But composer
may be of some assistance.
...
"autoload": {
...
"files": [
"app/etc/NonComposerComponentRegistration.php",
"setup/src/My/Setup/Model/Installer.php"
],
"exclude-from-classmap": [
"**/dev/**",
"**/update/**",
"**/Test/**",
"setup/src/Magento/Setup/Model/Installer.php"
]
}
...
The files
array tells composer to load those files first. The exclude-from-classmap
array tells composer to not load the file at all. So don't load the core file, copy it somewhere, make your modifications, and load your new file.
composer dumpautoload
command to make sure composer flushed its autoloader completely. If this doesn't help, try composer update --lock
to make sure the changes where updated in the project state.
Commented
Jan 11, 2020 at 21:08