Hey,

We have been using this module in our new D8 site, but using 8.2.x version. We use 8.2.x originally because it makes field_collection field an entity reference field, which makes a lot of things easier.

Unfortunately, 8.2.x is not supported anymore, and we have to pick either 8.1.x or 8.3.x. According to the description in project home page that 8.3.x makes field_collection an entity reference field too, which is a great news.

The thing is if this field_collection is an entity reference field, then we should be able to use field_collection as relationship for views. For example, we have profile entity enabled in our site, and profile entity has one field_collection called "Working experience" attached. This field collection has fields, like 'company', 'job title', 'working date'. etc. Now what we want to do is to create a relationship using this field_collection, so we can display specific fields(like 'company') from the field_collection at profile views.

8.2.x works greatly with this needs, but it looks like 8.3.x doesn't support this even though it is called 'entity reference'. The code inside this module for views relationship doesn't work at all.

Is there anything I have done wrong, or there's no such feature/support for 8.3.x. Thanks!

Comments

smiletrl created an issue. See original summary.

newkew’s picture

DieWaldfee’s picture

Hi,

as far as i know you can use your field as relationship.
I might have a similar problem, I can create the relationship and get the fields in my view. unfortunately I get this sql error.

I have this scenario reproduced local and on a server ->

add a content type
-add field_collection
-add a field

add content

create a view
- Add field -> get content
- Add the relationship -> get all related fields -> no content && sql error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node__field_apfelstrudel.field_apfelstrudel_value' in 'on clause': SELECT field_collection_item.item_id AS item_id, field_apfelstrudel_field_collection_item.nid AS field_apfelstrudel_field_collection_item_nid FROM {field_collection_item} field_collection_item INNER JOIN {node__field_apfelstrudel} node__field_apfelstrudel ON field_collection_item.item_id = node__field_apfelstrudel.field_apfelstrudel_value INNER JOIN {node_field_data} field_apfelstrudel_field_collection_item ON node__field_apfelstrudel.entity_id = field_apfelstrudel_field_collection_item.nid WHERE (( (field_collection_item.field_name IN (:db_condition_placeholder_0)) )) LIMIT 11 OFFSET 0; Array ( [:db_condition_placeholder_0] => field_apfelstrudel )

here is the query

SELECT field_collection_item.item_id AS item_id, field_apfelstrudel_field_collection_item.nid AS field_apfelstrudel_field_collection_item_nid
FROM 
{field_collection_item} field_collection_item
INNER JOIN {node__field_apfelstrudel} node__field_apfelstrudel ON field_collection_item.item_id = node__field_apfelstrudel.field_apfelstrudel_value
INNER JOIN {node_field_data} field_apfelstrudel_field_collection_item ON node__field_apfelstrudel.entity_id = field_apfelstrudel_field_collection_item.nid
WHERE (( (field_collection_item.field_name IN  ('field_apfelstrudel')) ))
LIMIT 11 OFFSET 0

maybe even someone appreciate this problem-or a solution for this, I'm for any help!?!

riddhi.addweb’s picture

imclean’s picture

See also #2823967: Views relationship "Host entity" is broken. Is this still a problem with 8.x-3.x-dev?

jmuzz’s picture

Yes views support has not been fixed for 8.x-3.x.

ram4nd’s picture

Status: Active » Closed (won't fix)
Issue tags: -field_collection, -Entity Reference