Enable Relationships in Views with Entities? I am creating some custom entities and one of them will need to contain a helper table to store a lot of data against one entity (event dates, prices, and tickets left). This is not a Commerce based app, we simply need to display the data appropriately as we receive it all from a third party service.

What I would like to do is rewrite the Entity implementation and not use Fields, but store this all as Properties, which will require its own table and fields with the proper foreign key back to the main Entity. Currently, it is all stored in Field Collections, which can be difficult to work with (Importing/Exporting the entity, or installing/uninstalling the module- FCs are just hard to script, attach, and add fields to in my experience).

So, assume:


entity
entity_event


I can get the data in and out fine.

With Views, how do I tell the Entity there is a relationship available here by the ID? When I am searching them with Views, I need to allow a search by date, AND that the event itself has tickets left (tickets wont be a exposed filter).

I assume too, that when buildContent() is called on the Entity to view it, here I attach the additional data from the event table?
You will need to use (or override) the views_handler_relationship class to create the relationship, and also use hook_views_data_alter(&amp;$data) to tell views how to use the handler and with which tables/columns it applies.