Closed (fixed)
Project:
External Entities
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Sep 2016 at 16:41 UTC
Updated:
13 Jan 2017 at 10:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
chrisroane commentedAttached is the patch. I'm using this on a site we are working on and confirmed it works
Comment #5
chrisroane commentedLet's try again.
Comment #7
chrisroane commentedCan anyone give me a clue as to why this patch is failing? Works fine for me.
Comment #8
attiks commentedNothing wrong "ERROR: No valid tests were specified." https://dispatcher.drupalci.org/job/default/215617/console
There are no tests (yet) for this module
Comment #9
chrisroane commentedAh I see. Thanks for the letting me know.
This works in giving access to the selected multiple options, but I ended up having to create a hook_form_alter() for getting the options selected on the edit form. I had updated the load() method but was getting a fatal error that was pointing to the entityreference module...which looked like the value wasn't correct. I couldn't track down where this was in the module.
Comment #10
attiks commentedTo be sure, it now works for single value and multi value fields?
Comment #11
chrisroane commentedWhat I did was added code to have the data get sent as an array for each field if it allows multiple values, which can then be used in the save() method. If a field is a single value field, it should work the same as it did before.
What I couldn't get to work was updating the load() method to use those fields. I was getting a fatal error, which I decided for the short term to preselect the options through a hook_form_alter() call. As long as you don't try to load the values in load(), it should be fine. I tried loading them as an array with different structures and couldn't get it to work.
Comment #12
rodrigoaguileraI needed this functionality but not only for simple values but also for entity reference so I made the logic more general so the special cases of adding and removing the "bundle-" prefix for the id are handled for multivalued fields also.
The mapObject function also needed the multi value logic and maybe that was problem you had for the load() method.
Te interdiff made no sense since most of it is rewritten.
Comment #14
rodrigoaguileraI wanted to map a field with multiple component like (or image field)
https://www.drupal.org/project/reference_value_pair
So I produce a conveniently keyed array from the client class.
I did a modification so if the value is an array instead of a string is feed to the entity as is.
I also added a basic mapping test but it lacks tests for multivalued fields
Comment #15
rodrigoaguileraHave one minimal test is great but it should test this issue.
We need to add one multivalued field to the external entity and map it into the object.
@chrisroane
Please give feedback about the recent changes and if they solve your problem
Comment #16
rodrigoaguileraAdded a term reference field to the test with 2 terms.
Comment #18
rodrigoaguileraooops
Comment #20
rodrigoaguileraMore missing "use"
Comment #22
rodrigoaguileraComment #24
rodrigoaguileraComment #26
rodrigoaguileraOk, no more using the testbot instead of a proper install of phpunit
Comment #27
rodrigoaguileraI found out that having an external entities index with search api tries to count all the external entities. That means that all of theme need to be loaded and maybe not all field definitions are installed yet.
Let's make sure entities can be counted without having their field definitions.
Comment #29
rodrigoaguileraTime to have a new release with this included.