Hey there, awesome module, awesome entity integration.

I just ran into a problem when I use the "modify entity values" operation to modify both entity properties and fields in one go.

Scenario:

  1. my modify entity value operation/action has been configured such that I can select several entity properties and/or fields.
  2. On the "Set parameters for Modify entity values" page I select at least one property and one field to modify.
  3. I fill out the fields I selected and go through the process of completing the operation.
  4. When the view reloads I see the changed values, however the last field value that I selected to modify did not get changed to the value I entered, but rather to the value I entered for the last property value I selected to modify.

Testing this thoroughly on several different sites and different types of entities (users, custom) shows that if you try to modify multiple properties only or multiple fields only, then everything works fine. Its the property/field combo that gets messed up somewhere. Also, obviously if the property and field types do not match up then a PDOException is thrown due to mismatching types in the db and the operation just fails.

A simple example: Add a simple text field to a user profile. Then use the modify entity value operation to modify a selected user's 'name' property and your text field. You'll find that the text field will be set to the value you entered for the name property.

I'll try to find some time to look into the code to find the source of the problem, but for now I will post the issue and perhaps in the meantime someone else might figure it out.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz’s picture

Interesting bug. Try the -dev version first (and look at that version), since there have been fixes to that action since rc1.

acrazyanimal’s picture

Version: 7.x-3.0-rc1 » 7.x-3.x-dev
Status: Active » Needs review
FileSize
3.35 KB

I guess I should have set the version to dev in the issue as I was looking at both. I checked into it and it looks like it could possibly have something to do with the entities in core. I stepped through the code and everything looks fine, but each time $wrapper->$key->set($value); is called to set the property value, it for some reason also sets the last modified field value as well. Super weird.

Anyway, I unfortunately don't have time to look into core entity code, but I have found that switching the order in which fields/properties are modified fixes the issue.

Here is a patch.

acrazyanimal’s picture

Erg ... darn whitespace errors. Here is a better de-whiteified patch.

cheers.

damiankloip’s picture

bojanz’s picture

Status: Needs review » Fixed

Your hunch was correct, Damian.
Pushed a fix.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

grammar