entity_load failure: Adding revision capability to entity with existing data and unticking "create new revision" still creates a revision I am having trouble with entity_load returning an empty array on an entity api custom entity which previously was fine. The only change I've made is to add revision support which apart from creating the revision table etc. has also created a revision ID column in my custom entity table and filled this with NULL by default.

In troubleshooting why this is and trying to pin down if the revision is causing my problem, I've come across something which seems peculiar to me: creating an Article and unchecking "create new revision" still creates a revision.

My custom entity revision table is currently completely empty and I've been debugging and stepping through the code within entity_load but I cannot see where the problem is.

Where is my problem with the entity_load? Is the new revision being created despite unchecking the option a localised problem?
So I experimented and contrary to what I perceived, saving a node (as an example of an entity) even without "save a new revision" checked, still saves a revision...

So somewhere in the confusing bowels of the entity loading procedure it was diving through Drupal-shaped rabbit holes and trying to load revision information because it noted that the custom entity was revision enabled (where I enabled it in hook_entity_property_info). Because I'd only added the revision capability after using the entity there was none. So I had to do some SQL work.

Firstly I selected all information in the original table into the new table. In doing so, the auto-increment setup on the revision_id column populated the revision_id column in the revision_id with unique incremental values. 

Secondly I did a big ol' looping thing to get all the revision_ids from the revision table and one-by-one put them in the original table. Details of that query are here after I had a little bit of trouble, but it might help someone else out.

Now it's working.