I made an entity called "transaction" using the ECK UI
/admin/structure/entity-type/add
After a while I got stuck with this error at
/admin/structure/entity-type/transaction
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 179 of /public_html/includes/entity.inc).
Recoverable fatal error: Object of class Entity could not be converted to string in DatabaseStatementBase->execute() (line 2168 of /public_html/includes/database/database.inc).
Turns out the reason was at DrupalDefaultEntityController->attachLoad() where they:
call_user_func_array($module . '_' . $this->entityInfo['load hook'], $args);
I'm using Drupal Commerce and my entity was called "transaction", but that apparently clashed with Drupal Commerce, since the previous snippet translated to: commerce_payment_transaction_load, which gave the error.
Could you recommend a way of fixing this? Should I make a validator for the entity-type/add form which would check for existing entity names perhaps?
Comments
Comment #1
KimmoT commentedAfter a bit of testing I noticed this might not be a naming issue. I have to double check what the cause is.
Comment #2
KimmoT commentedAt first this looked like a duplicate of:
https://drupal.org/node/1345264
But after renaming the conflicting entity and bundle I still get the error:
...when trying to view, edit or delete a single entity via the entity list at
domain.com/{entity}/{bundle}/4
domain.com/{entity}/{bundle}/4/edit
domain.com/{entity}/{bundle}/4/delete
Comment #3
acbramley commentedGetting these errors on fresh install. Steps to reproduce:
1) Install drupal minimal installation
2) Download and enable latest dev version of ECK (this will install ctools and entity)
3) Create a new entity type through the ui with a bundle.
4) Create a new item of your new entity
5) Try to view this item.
Comment #4
acbramley commentedBy the way my entity and bundle were:
legal_entity
rest_home
so urls were /legal_entity/rest_home/1
Comment #5
acbramley commentedDuplicate of #1920602: Use entity modules API to get entity type and bundle