cancel
Showing results for 
Search instead for 
Did you mean: 

Errors during compilation ?

Errors during compilation ?

i have this error after i run the s:d:c command. How to fix this and could explain to me what happened with my DataProvider and Controller Files. I really appreciate it.

 

Errors during compilation:
Rakuten\MemberCard\Model\Config\DataProvider
Incompatible argument type: Required type: string. Actual type: \Rakuten\MemberCard\Model\Config\name; File: 
/var/www/html/rakuten_magento/app/code/Rakuten/MemberCard/Model/Config/DataProvider.php

Rakuten\MemberCard\Controller\Adminhtml\Card\Index
Incompatible argument type: Required type: \Magento\Backend\App\Action\Context. Actual type: \Magento\Framework\App\Action\Context; File: 
/var/www/html/rakuten_magento/app/code/Rakuten/MemberCard/Controller/Adminhtml/Card/Index.php

Total Errors Count: 2

 

 

4 REPLIES 4

Re: Errors during compilation ?

Hello @annq3sivn4281 

 

Replace

use Magento\Framework\App\Action\Context;

With

use Magento\Backend\App\Action\Context;

It may help you!
Thank you 

Problem solved? Click Accept as Solution!

Re: Errors during compilation ?

How about my DataProvider files. What should i do ?

Re: Errors during compilation ?

Hello @annq3sivn4281 

 

Regarding data provider file take reference from below code:

use Magento\Framework\App\Request\DataPersistorInterface;

class DataProviderFileName extends \Magento\Ui\DataProvider\AbstractDataProvider

 

It may help you!
Thank you 

Problem solved? Click Accept as Solution!

Re: Errors during compilation ?

Hello @annq3sivn4281 ,

 

So here the issue is your file DataProvider is extending any another class, but the parent constructor section defined in DataProvider class constructor is incorrectly formed.

so the DataProvider constructor argument parameters are expecting arguments same as the extended class.

The origin of this issue could be that if this a third party module then it's dependent modules version / Magento version is changed. You can get the latest version module from vendor which is compatible to your Magento version.

If you're writing DataProvider class on your own, then make sure you inject parent constructor arguments in your extended file constructor argument with similar pattern.

 

If you still need further help, post constructor data of DataProvider class and the extended class constructor.

 

Hope it helps !

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy