I have a custom entity called "release". Release has "state" and "building percentage" fields, which values may change during the release process.
In both "setState" and "setPercentage" entity method I explicitly do the following:
However, during the process, the "changed" column in the database always remains the same value. Am I missing something? What could be wrong?
UPDATE: Running the "setState" and "setPercentage" in a test script separated, the database gets updated.
I got it. "ChangedItem.php" - line 37, I logged there, and this is where it sets back to the request time value:
// On an existing entity translation, the changed timestamp will only be // set to the request time automatically if at least one other field value // of the entity has changed. This detection does not run on new entities // and will be turned off if the changed timestamp is set manually before // save, for example during migrations or by using // \Drupal\content_translation\ContentTranslationMetadataWrapperInterface::setChangedTime().
will be turned off if the changed timestamp is set manually before save
This "promise" of the comment is definitely not working. Any suggestions?