Aakash Tushar
Aakash Tushar

Reputation: 504

Error "Please enter a correct entity model." while Importing CSV in custom module in Magento 2

I receive this error when i'm trying to import a list of sellers (custom module). I want to know what is the meaning of this error? and where should I start to fix the problem? X Please enter a correct entity model.

PS: Please let me know if you need more info.

Upvotes: 0

Views: 5146

Answers (3)

Roberto
Roberto

Reputation: 41

I got the same error when I added parent::__construct to my import class and when I add a new dependency in the construct. So the solution may be to remove parent::__construct from your class construct, or if you don't have the parent::__construct and you still get this error, you should run a

bin/magento s:d:c

If you are going to remove the parent construct, make sure to add the message assignment in your construct so you don't lose the validation messages.

foreach ($this->errorMessageTemplates as $errorCode => $message) {
    $this->getErrorAggregator()->addErrorMessageTemplate($errorCode, $message);
}

Upvotes: 0

Pradeep Thakur
Pradeep Thakur

Reputation: 151

a) Simply solution to reset the folder permission due to export/import file will be save in var/export or var/import folder.

chmod -R 0777 var/

b) Check the exception.log file in var/log

Upvotes: 1

Diego Sanabria
Diego Sanabria

Reputation: 31

In my, case i had parent::__consturct() in my __construc() method. Then the parent class is an abstract class. I think there is the error.

public function __construct(
    \Magento\Framework\Json\Helper\Data $jsonHelper,
    \Magento\ImportExport\Helper\Data $importExportData,
    \Magento\ImportExport\Model\ResourceModel\Import\Data $importData,
    \Magento\Eav\Model\Config $config,
    ResourceConnection $resource,
    \Magento\ImportExport\Model\ResourceModel\Helper $resourceHelper,
    \Magento\Framework\Stdlib\StringUtils $string,
    ProcessingErrorAggregatorInterface $errorAggregator
)
{
    parent::__construct($jsonHelper, $importExportData, $importData, $config, $resource, $resourceHelper, $string, $errorAggregator);
}

Without parent::__construct() the error message disappear.

Upvotes: 2

Related Questions