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:
- my modify entity value operation/action has been configured such that I can select several entity properties and/or fields.
- On the "Set parameters for Modify entity values" page I select at least one property and one field to modify.
- I fill out the fields I selected and go through the process of completing the operation.
- 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.
Comment | File | Size | Author |
---|---|---|---|
#3 | VBO-modify-entity-values-properties-order-1515168-2.patch | 3.34 KB | acrazyanimal |
#2 | VBO-modify-entity-values-properties-order-1515168-1.patch | 3.35 KB | acrazyanimal |
Comments
Comment #1
bojanz CreditAttribution: bojanz commentedInteresting bug. Try the -dev version first (and look at that version), since there have been fixes to that action since rc1.
Comment #2
acrazyanimal CreditAttribution: acrazyanimal commentedI 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.
Comment #3
acrazyanimal CreditAttribution: acrazyanimal commentedErg ... darn whitespace errors. Here is a better de-whiteified patch.
cheers.
Comment #4
damiankloip CreditAttribution: damiankloip commentedI think this may also be related to #1515340: First items token value is populated for other nodes
Comment #5
bojanz CreditAttribution: bojanz commentedYour hunch was correct, Damian.
Pushed a fix.
Comment #6.0
(not verified) CreditAttribution: commentedgrammar