Comments

chrisroane created an issue. See original summary.

chrisroane’s picture

Status: Active » Needs review
StatusFileSize
new1.28 KB

Attached is the patch. I'm using this on a site we are working on and confirmed it works

Status: Needs review » Needs work

The last submitted patch, 2: cardinality_issue-2800817.patch, failed testing.

The last submitted patch, 2: cardinality_issue-2800817.patch, failed testing.

chrisroane’s picture

Status: Needs work » Needs review
StatusFileSize
new1.28 KB

Let's try again.

Status: Needs review » Needs work

The last submitted patch, 5: cardinality_issue-2800817-11627859.patch, failed testing.

chrisroane’s picture

Can anyone give me a clue as to why this patch is failing? Works fine for me.

attiks’s picture

Nothing wrong "ERROR: No valid tests were specified." https://dispatcher.drupalci.org/job/default/215617/console

There are no tests (yet) for this module

chrisroane’s picture

Ah 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.

attiks’s picture

To be sure, it now works for single value and multi value fields?

chrisroane’s picture

What 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.

rodrigoaguilera’s picture

Title: Add support for cardinality » Add support for multivalued fields
Status: Needs work » Needs review
StatusFileSize
new2.65 KB

I 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.

Status: Needs review » Needs work

The last submitted patch, 12: 2800817-multivalue-12.patch, failed testing.

rodrigoaguilera’s picture

Status: Needs work » Needs review
StatusFileSize
new4.96 KB
new2.9 KB

I 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

rodrigoaguilera’s picture

Assigned: chrisroane » Unassigned
Status: Needs review » Needs work

Have 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

rodrigoaguilera’s picture

Status: Needs work » Needs review
StatusFileSize
new6.45 KB
new3.18 KB

Added a term reference field to the test with 2 terms.

Status: Needs review » Needs work

The last submitted patch, 16: 2800817-multivalue-16.patch, failed testing.

rodrigoaguilera’s picture

Status: Needs work » Needs review
StatusFileSize
new6.52 KB
new584 bytes

ooops

Status: Needs review » Needs work

The last submitted patch, 18: 2800817-multivalue-18.patch, failed testing.

rodrigoaguilera’s picture

Status: Needs work » Needs review
StatusFileSize
new6.61 KB

More missing "use"

Status: Needs review » Needs work

The last submitted patch, 20: 2800817-multivalue-20.patch, failed testing.

rodrigoaguilera’s picture

Status: Needs work » Needs review
StatusFileSize
new6.61 KB

Status: Needs review » Needs work

The last submitted patch, 22: 2800817-multivalue-22.patch, failed testing.

rodrigoaguilera’s picture

Status: Needs work » Needs review
StatusFileSize
new6.67 KB

Status: Needs review » Needs work

The last submitted patch, 24: 2800817-multivalue-24.patch, failed testing.

rodrigoaguilera’s picture

Status: Needs work » Needs review
StatusFileSize
new7.24 KB

Ok, no more using the testbot instead of a proper install of phpunit

rodrigoaguilera’s picture

StatusFileSize
new7.33 KB
new686 bytes

I 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.

  • rodrigoaguilera committed 99695ba on 8.x-1.x
    Issue #2800817 by rodrigoaguilera, chrisroane: Add support for...
rodrigoaguilera’s picture

Status: Needs review » Fixed

Time to have a new release with this included.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.