0

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?

1

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.

2
  • I've done what you stated, issued a composer update, and confirmed my file is being loaded... But breakpoints still fire on the original file. – CarComp Jan 10 '20 at 15:55
  • try 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. – wesleywmd Jan 11 '20 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.