Sales module MassAction refactoring #9197
I think that the MassAction feature in the Sales module is not correctly architectured as it contains hidden dependencies.
If you try to create your own mass action in the sales grid you need to extend the base MassAction class. If you do that you will end up with a fatal error when you use it in admin panel:
"Fatal error: Call to a member function create() on a non-object"
The problem is this:
So the collectionFactory should be injected into constructor but you realize that only after you examine the entire class. We shouldn't do that as we have dependency injection in order to make dependencies visible.
You can find out more about this on my blog post http://dusanlukic.com/magento-2-hidden-dependency-refactoring
I moved the dependency into abstract method making it mandatory for child classes to provide the collection.
This feature needs more refactoring, this would be the first step.
No tests needed as public api remains unchanged.
Thank you for your everyone collaboration!
- deprecated Sales AbstractController - added comments in Abstract model to deprecated methods