1

I have a drupal 8 custom entity and have it referencing another custom entity of a different type. It is a one-to-many relationship like a department with assets. It won't recognize the assets relationship (but it will recognize the one-to-ones). How do I make that bridge in my EntityViewsData extended class so that I can use assets in the Relationships section of the Views UI? I have scoured the docs and core entities and cannot find the answer.

More info: The department has a base table 'department' and another table 'department__assets' that the reference created. 'department_assets' has a field 'entity_id' that connects the table to the department and a field 'asset_target_id' that connects the asset table. The assets base table is 'asset'.

  • Did you get this to work? Im trying to make a similar one to many relationsship but cant figure out how to make views find the relationsship. Is it a @ViewsRelationship annotation that is required? – Johan Jun 21 '17 at 9:21
0

That's currently a gap in the automatic entity views data integration, it can only do multi-value configurable fields.

Work is going on to improve this, not sure if it will make it into 8.1 now, probably it will have to wait for 8.2, but you could already use the patch: https://www.drupal.org/node/2477899

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.