Users who would like to have automatic revision tracking of entity updates can set a bundle setting for bundleable entities that determines whether a new revision is automatically created on update or not. JSON:API can use this setting to make this feature possible in decoupled scenarios.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3038453-10.patch | 15.62 KB | wim leers |
| #10 | interdiff.txt | 670 bytes | wim leers |
| #7 | 3038453-7.patch | 15.53 KB | wim leers |
| #7 | 3038453-7-FAIL.patch | 15.5 KB | wim leers |
| #7 | interdiff.txt | 1.66 KB | wim leers |
Comments
Comment #2
gabesulliceComment #3
gabesulliceComment #4
wim leers🔍🐛 Übernit: I don't see why we're changing this. Can easily be reverted on commit though.
✅ This is functionally identical to the code I wrote nearly two years ago in #2838395-27: [PP-1] Entity API bug affecting REST: "last changed" timestamp not updated and "create new revision" setting not respected when PATCHing via REST. Looks good :)
✅
block_content.type.basic.ymlalso hasrevision: 0, and we're already ensuring the correct expected behavior forNode, no need to do it for multiple entity types. Works for me. 👍👏 Great, we're testing this for
Node, where this is most expected to work.✅ We now have to bypass the test runner's static entity cache, to ensure we fetch the latest revision of the just-
PATCHed entity. 👍✅ And we then verify the current revision ID is greater than the prior.
✅ Ah,
\Drupal\Core\Entity\ContentEntityStorageBasehas a$this->latestRevisionIdsstatic cache, which without this::resetCache()call would result in the test assertions being unable to correctly assert that a revision is indeed the latest revision. Static caches strike again!Comment #5
plachShouldn't this happen only when we create a new revision? I.e. we should add an
::isNewRevision()call. This would also take care of new entities.Why do we need this?
::loadUnchanged()will always load data from the storage.Comment #6
wim leersresetCache()you'll see that the test fails.Comment #7
wim leersTest coverage for #6.1.
Comment #8
plachLooks good to me, if green!
Comment #10
wim leersFor #6.2, @plach just opened #3038706: Clean up ::entityLoadUnchanged in ResourceTestBase. Adding a
@todoto point to that, so we can get rid of that in the future.Comment #12
wim leers