You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a class that extends Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction.
Use that mass action from dropdown.
Expected result
No errors.
Actual result
PHP Fatal error: Call to a member function create() on null in /var/www/html/magento2/app/code/Magento/Sales/Controller/Adminhtml/Order/AbstractMassAction.php on line 54
It is not obvious that the child class requires collectionFactory to be injected so it's not transparent which objects are needed for this class to work.
I tried to create a PR for this, by moving the collection factory to constructor, but the problem is that for example this class:
Steps to reproduce
develop
branch.Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction
.Expected result
Actual result
There is a hidden dependency in https://github.com/magento/magento2/blob/develop/app/code/Magento/Sales/Controller/Adminhtml/Order/AbstractMassAction.php#L54
It is not obvious that the child class requires collectionFactory to be injected so it's not transparent which objects are needed for this class to work.
I tried to create a PR for this, by moving the collection factory to constructor, but the problem is that for example this class:
https://github.com/magento/magento2/blob/develop/app/code/Magento/Sales/Controller/Adminhtml/Order/Pdfinvoices.php
Requires
Magento\Sales\Model\ResourceModel\Order\Collection
and this one:https://github.com/magento/magento2/blob/develop/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment/Pdfshipments.php
Requires
Magento\Sales\Model\ResourceModel\Order\Shipment\CollectionFactory
These two don't have the same parent class or interface, so it seems that it's not possible to type hint.
Any thoughts?
The text was updated successfully, but these errors were encountered: