You don't extend properly \Magento\Customer\Controller\Adminhtml\Index
to your class when try to call __construct
. If you check the code of then you find a lot of parameters need __construct:\Magento\Customer\Controller\Adminhtml\Index
.
<?php
namespace Vendor\Module\Controller\Adminhtml\Sendcredentials;
class Index extends \ Magento\Customer\Controller\Adminhtml\Index
{
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
\Magento\Customer\Model\CustomerFactory $customerFactory,
\Magento\Customer\Model\AddressFactory $addressFactory,
\Magento\Customer\Model\Metadata\FormFactory $formFactory,
\Magento\Newsletter\Model\SubscriberFactory $subscriberFactory,
\Magento\Customer\Helper\View $viewHelper,
\Magento\Framework\Math\Random $random,
\Magento\Customer\Api\CustomerRepositoryInterface $customerRepository,
\Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter,
\Magento\Customer\Model\Address\Mapper $addressMapper,
\Magento\Customer\Api\AccountManagementInterface $customerAccountManagement,
\Magento\Customer\Api\AddressRepositoryInterface $addressRepository,
\Magento\Customer\Api\Data\CustomerInterfaceFactory $customerDataFactory,
\Magento\Customer\Api\Data\AddressInterfaceFactory $addressDataFactory,
\Magento\Customer\Model\Customer\Mapper $customerMapper,
\Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor,
\Magento\Framework\Api\DataObjectHelper $dataObjectHelper,
\Magento\Framework\DataObjectFactory $objectFactory,
\Magento\Framework\View\LayoutFactory $layoutFactory,
\Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory,
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
\Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory,
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory)
{
parent::__construct($context, $coreRegistry, $fileFactory, $customerFactory, $addressFactory, $formFactory, $subscriberFactory, $viewHelper, $random, $customerRepository, $extensibleDataObjectConverter, $addressMapper, $customerAccountManagement, $addressRepository, $customerDataFactory, $addressDataFactory, $customerMapper, $dataObjectProcessor, $dataObjectHelper, $objectFactory, $layoutFactory, $resultLayoutFactory, $resultPageFactory, $resultForwardFactory, $resultJsonFactory);
}
public function execute() {
}
}
No of parameters at __construct:\Magento\Customer\Controller\Adminhtml\Index
is 25 ,https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Customer/Controller/Adminhtml/Index.php#L201-L225
but your extends class's has two parameters parent::__construct($context, $data)
.So no of parameters should be same for extends __construct and original one.