Closed (fixed)
Project:
Services Entity API
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Feb 2013 at 13:57 UTC
Updated:
5 Apr 2013 at 16:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
joachim commentedAh, the first problem will be that the resource won't get created properly:
because $target_entity is a bundle name. This will only work with entities with a single bundle that has the same name as the entity.
Comment #2
joachim commentedThis takes some figuring out:
We're acting on each bundle the field points to. $target_entity is each bundle name, and so the resource setting will fail. $entity_type is the entity this field is on.
So what we're trying to do is add to the target entity a resource of the entities that point to it.
Problem is the target entity is the wrong variable.
Also, why are we looping on bundles, if it's to clobber the resource each time?
Comment #3
joachim commentedHere's a patch.
I've removed the loop on target bundles, since:
a) it doesn't appear to serve any purpose, as the bundle name isn't used, and $target_entity which is really the bundle name won't create valid resources
b) it's the source of another bug: that if the entref field has NO bundles selected, to indicate that all are valid, no resource is created at all.
Note that this patch, while fixing THIS problem, now exposes another: #1911810: multiple fields from one entity type to another clobber the resource.
Comment #4
joachim commentedI contacted the other maintainer last week to ask for a review of this, but looking at it again, I'm sure this is the right thing to do -- it just doesn't make sense as it is (unless your entities are single-bundled, and the bundle has the same name as the entity!).
Also, it's holding up #1936472: create forward Services relationships for entityref fields as well as backwards :)