Skip to content

Add touch for entity timestamps - #341

Open
elpete wants to merge 1 commit into
nextfrom
feat/53-touch-timestamps
Open

Add touch for entity timestamps#341
elpete wants to merge 1 commit into
nextfrom
feat/53-touch-timestamps

Conversation

@elpete

@elpete elpete commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #53

Issue review

Recommendation: 7/10 — implement. A touch() helper is a familiar, concise way to update an entity timestamp without manually setting it. It is especially useful for cache invalidation and recording activity that does not otherwise change attributes. The issue has no detailed body, so this PR intentionally implements the small Eloquent-style entity operation rather than automatic timestamps or relationship cascading.

The tradeoff is that touch() uses the normal save lifecycle and therefore persists any other dirty attributes on the entity as well.

Implementation

  • adds touch(attribute="modifiedDate", options={}) to loaded entities
  • supports schemas with a different timestamp attribute
  • uses the normal public assignment and save flow
  • preserves read-only checks, SQL typing, dirty tracking, and persistence events

Test-first evidence

The public regression initially errored with QuickMissingMethod. It now verifies the in-memory timestamp advances, the entity is clean after touching, and a fresh database read contains the advanced timestamp.

Validation

  • focused SaveSpec: 19 passed, 0 failed, 0 errors
  • full Lucee 6 suite: 496 passed, 0 failed, 0 errors, 3 skipped
  • box run-script format
  • git diff --check

Uses qb@14.0.0-beta.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant