-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define dependency of Magento_CatalogUrlRewrite to Magento_ImportExport as soft dependency #21125
Define dependency of Magento_CatalogUrlRewrite to Magento_ImportExport as soft dependency #21125
Conversation
Hi @avstudnitz. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
I see there is a test failing which checks for dependency declarations. |
@kandy can you please comment on what @avstudnitz proposed? Thanks! |
@avstudnitz, @miguelbalparda Yep, It's common recommendation to move hard dependencies in separate module (see MSI, GraphQL modules as example) |
@avstudnitz would you rather keep working on this PR or create a new one for the changes @kandy proposed? |
Let's keep working on this. It might take a few weeks until I get to work on this again. |
Hi @avstudnitz , will you continue progress on the PR? |
Sorry, I don't have time at the moment. You can close it for now. |
@avstudnitz , I am closing this PR now due to inactivity. |
Hi @avstudnitz, thank you for your contribution! |
Description (*)
When trying to remove all
*ImportExport
modules, the only unexpected dependencies were those from the Magento_CatalogUrlRewrite to Magento_CatalogImportExport and Magento_ImportExport:The Magento_CatalogUrlRewrite module contains two observers (
\Magento\CatalogUrlRewrite\Observer\AfterImportDataObserver
,\Magento\CatalogUrlRewrite\Observer\ClearProductUrlsObserver
) which observe events from the Magento_CatalogImportExport module (catalog_product_import_bunch_save_after
,catalog_product_import_bunch_delete_after
) and contain references to ImportExport modules (constants and return types only, no classes instantiated via DI).If Magento_CatalogImportExport is disabled or removed, these two observers aren't instantiated or used otherwise. This means, Magento_CatalogUrlRewrite will work perfectly if the ImportExport modules are not available. In my opinion it's a soft dependency ("A module with a soft dependency on another module can function properly without the other module, even if they have a dependency upon it.", see https://devdocs.magento.com/guides/v2.3/architecture/archi_perspectives/components/modules/mod_depend_types.html). Thus, I suggest to not
require
the classes in question but justsuggest
them so we can use Magento_CatalogUrlRewrite without Magento_CatalogImportExport and Magento_ImportExport.Manual testing scenarios (*)
composer.json
:Contribution checklist (*)