Repository navigation
[13.x] Fix: add missing check for #[WithoutTimestamps] on model ignore touch - #61073
Merged
Merged
Conversation
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
bram-pkg
force-pushed
the
read-withouttimestamps
branch
from
August 6, 2026 10:26
4e97714 to
b2a13b6
Compare
#[WithoutTimestamps] attribute on ignore touch
#[WithoutTimestamps] attribute on ignore touch#[WithoutTimestamps] on model ignore touch
bram-pkg
marked this pull request as ready for review
August 6, 2026 10:28
eas4ai
added a commit
to eas4ai/suprnova
that referenced
this pull request
Aug 19, 2026
Adds the runtime cascade for `#[model(touches = [...])]`: after a child model is created, saved, updated, deleted, or force-deleted, every declared `BelongsTo` owner gets one `UPDATE <owner> SET updated_at = ? WHERE <key> = ?` on the same executor as the triggering write, so it joins an ambient `DB::transaction` and rolls back with it. - `EloquentModel` gains `TOUCHES`, `HAS_TIMESTAMPS`, `UPDATED_AT_COLUMN` consts; `RelationEntry` gains `related_updated_at_column`, collapsed from the target's two consts via the new `touch_column` const fn. - `Model::touch_owners` / `touch_owners_with_tx` / `__touch_owners_via` are new trait-default methods, wired into all 10 write-path call sites (create/save/update/delete/force_delete + the five `_with_tx` shims) and into the soft-delete macro's inherent delete/force_delete overrides. - `without_touching_on::<M, _, _>` adds a per-type suppression scope (Laravel's `withoutTouchingOn`), and the existing `without_touching` now also suppresses the owner cascade, not just direct `.touch()`. - The macro validates `touches` at expansion time: every name must resolve to a declared `BelongsTo` relation, or it's a compile error. - An owner with `timestamps = false` is skipped, not written and not an error (laravel/framework#61073); same for a NULL FK or a soft-deleted owner. - Breaking change: `TOUCHES` moves from an inherent const to `EloquentModel`, since the cascade needs it reachable from a trait default. `Comment::TOUCHES` still resolves with `EloquentModel` in scope. Deliberately out of scope: `restore()` does not touch (Suprnova's restore is a raw UPDATE, not a `save()`), and the cascade is one level deep and event-free (no parent hydration, no grandparent recursion, no parent `saved` event) - both documented in manual/eloquent.md's "Why Suprnova diverges". Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
binaryfire
added a commit
to hypervel/components-backup
that referenced
this pull request
Oct 1, 2026
Port refreshForUpdate with the shared refresh query path, upstream unit and integration coverage, and usage documentation. Preserve model key validation and relationship reload behavior. Make relationship touching honor WithoutTimestamps and the same property/attribute precedence as model initialization. Disabled models could otherwise write updated_at, including on tables without that column. Strengthen the precedence cases and reconcile both attribute cache-order tests against the existing instance-based cache. Complete the missing multi-attribute touch model test and documentation. Use the upstream keyed AsPivot lookup in the moved refresh helper; the rest of the trait lookup PR remains under reconciliation. Upstream: laravel/framework at 01d008c9b5f32cb7c5e50a9a22273113d810b2a2. laravel/framework#61247 laravel/framework#59175 laravel/framework#61073 laravel/framework#60815 laravel/framework#59457 Validation: timestamp precedence regressions failed before the correction and pass afterward; SQLite relation touching verifies inherited disabling. Changed test files, affected Eloquent ParaTest, full source/type analysis, and scoped formatting pass. Refresh integration tests also pass after the final trait lookup correction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the
#[WithoutTimestamps]attribute is ignored when checking if a model is supposed to be touched, and only#[Table(timestamps: false)]is checked. Behaviour should be the same between these two.