While working on #1266036: Add generic Views entity tables with fields and relationships we ran over the issue that only base tables can be assigned to entity types, but not tables that are not defined as base tables.

Moving it over to the table definition would be an API change now, though.

Comments

dawehner’s picture

Can you provide a use case where you want to attach something to a table which is not a base table?

dawehner’s picture

It's currently hard to guess one, sorry.

drunken monkey’s picture

In #1266036: Add generic Views entity tables with fields and relationships we want to provide Views tables (but not base tables, since there is no query class (+ other reasons)) for all entity types, to be, e.g., used in relationships (by the Search API for instance).
For getting support for things like #1270890: provide a way to provide entity-related views fields, it would still be nice to be able to define an entity type for them.

(Incidentally, it would be great to get your feedback on the first mentioned issue – whether this makes sense in your opinion, and maybe provide help if we get stuck. We aren't a 100% sure about the relationships, for example – a quick review once we have something working would probably help a lot.)

dawehner’s picture

There shouldn't be a problem with moving up this key to the $data['name']['table']['entity key'] level.

I guess all people knowing about this information are already active on this issue, so there shouldn't break too much things.

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new4.64 KB

Here is a patch which moves the existing data + the code in query_default + writes something in the upgrade file.

drunken monkey’s picture

StatusFileSize
new4.63 KB

You wrote "entity key" instead of "entity type" in some instances. Attached patch fixes this.
Other than that, the patch looks good.

dawehner’s picture

Hehe got the documentation wrong :)

fago’s picture

--- a/modules/file.views.inc
+++ b/modules/file.views.inc
@@ -30,6 +30,7 @@ function file_field_views_data($field) {
       'base field' => 'fid',
       'label' => t('file from !field_name', array('!field_name' => $field['field_name'])),
     );
+
   }

Unrelated new line, else the patch looks good to me.

dawehner’s picture

Status: Needs review » Fixed
     );
+
   }

This bug existed because i thought, hey there is a file entity so just add it here, ugh, there is no base table here... forgot about it.
In reality the table data is in the system.views.inc so the file_managed table didn't had this integration yet.

Commited this patch with the change for the file entity.

drunken monkey’s picture

@ fago: Please notify me when you adapt Entity API to this, either here or per mail, so Search API is as shortly as possible „incompatible“.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.