Question

I'm trying to create a new Eav Entity after this instruction post.
Then i got this issue:

Call to a member function getEntityType() on null

I'm still new with Eav Entity, so can some one help me to figure out what the problem is?

Here is my custom module after follow the instruction: this link

Thanks.

Was it helpful?

Solution

Replace your Aht/Custom/Model/ResourceModel/Department.php, Aht/Custom/Model/ResourceModel/Employee.php Aht/Custom/Setup/InstallSchema.php with content inside this files: https://gist.github.com/rendyep/496a94777662f9729b9422a842b6e415

Get into your mysql client console and do cleanup of some tables created while you failed executing upgrade:

mysql> drop table department;
mysql> drop table employee;
mysql> drop table employee_entity;
mysql> drop table employee_entity_datetime;
mysql> drop table employee_entity_decimal;
mysql> drop table employee_entity_int;
mysql> drop table employee_entity_text;
mysql> drop table employee_entity_varchar;
mysql> delete from setup_module where module = 'Aht_Custom';

Do upgrade again:

$ bin/magento setup:upgrade
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top