I have a custom content type with some fields. I would like to create a better overview of the changes between the revisions, so I have created a node revision view.
However if I try to run it, I get a fatal error in entity_get_controller(). The problem is that it is get called with an empty string. I was successfully able to trace back the problem to views_handler_field_field.inc:78.
$this->entity_type = $entity_type = $this->definition['entity_tables'][$base_table];
The problem here is that the definition only holds info for the node entity, while the $base_table is node_revision, so $this->entity_type and $entity_type will be NULL.
Comments
Comment #1
bojanz commentedYeah, field revisions are kinda broken at the moment :/
Comment #2
dawehnerThis seems to be a real critical issue :(
Comment #3
chsoney commentedI created a fix for this, but it seems a little to much like a hack. There is a huge assumption in my code stating if an entity type does not exist, then it is revision for an entity type. Also, I have to load each node/revision separately.
Comment #4
chsoney commentedComment #5
merlinofchaos commentedOk, this is, I think, the right way to fix this without being hacky.
Comment #7
bojanz commentedVery nice. I'm just leaving the appartment so I can't test, but it looks clean, and it can't be more broken than the previous code, so if it works, consider this my RTBC :)
Also, passing the base table through the definition is just what I need for the Per Bundle storage Views integration.
Comment #8
dawehnerAs written in irc it would be cool if there would be an explanation why iterate about each entity_id but in general it's rtbc.
Comment #9
merlinofchaos commentedCommitted and pushed, despite what testbot thinks.
Comment #10
jamsilver commentedJust downloaded the 7.x-3.0-beta3 release and am getting the following PHP notice:
Notice: Undefined index: revision table in field_views_field_default_views_data() (line 182 of .../views/modules/field.views.inc).
On dsm-ing out the code at that point - it looks like the above fix is incompatible with a field that appears on more than one entity type. In my case I have a field which is present on a node *and* on a term. To be specific, it would appear that the following lines (177 - 182):
makes assumptions about the lingering value of
$entity_info- a variable which was defined in a separateforeachloop (over the bundles the field appears on) on lines 89-129. If a field appears on more than one entity type then this bundle loop will have more than one iteration.My particular problem arises because the first iteration (on 'node' entity) is sufficient to set the
$supports_revisionsflag - since nodes do indeed support revisions. However the lingering value for$entity_infois for the taxonomy_term entity type - which does not support revisions. So$entity_info['revision table']is empty at line 181.I would normally be up for submitting a patch to fix this straight off, but I'm afraid the fix doesn't look straightforward to me - I don't understand the significance of all the places
$entity_infois depended on in this block. It could be that the approach of the code here is not quite right - since it appears to assume implicitly that a field will only appear on one entity?Perhaps views is intended to be incompatible with fields that appear on more than one entity?
Comment #11
dawehnerPlease update to the latest dev version. It's fixed there already.