Commit 80773ab
authored
fix(controller): register super<name> for app-level controller and view overrides (#3357)
Following the "Overriding Core Methods" guide — override `linkTo()`, delegate with
`superLinkTo()` — returned a 500, because `superLinkTo` never existed in controller or view
context.
The convention was implemented asymmetrically. `Model.cfc`'s $integrateFunctions() aliases
the framework original to `super<name>` whenever the mixin's name is ALREADY present on the
target, which is precisely the app-override case. `Controller.cfc`'s had no such branch: it
aliased only names a registered plugin/package mixin overrode. So model overrides got
`superFindAll()` and controller/view overrides got nothing, with no indication why.
Adding the same else-branch is the whole fix. Before writing it I measured the cost, because
`Controller` mixes in a much larger surface than `Model` and this runs on every request: a
controller that overrides nothing has 445 keys and gains ZERO `super*` entries, before and
after. No two framework mixins contribute the same name, so the branch fires only on a
genuine app override — where the extra reference is the point.
`Mapper.cfc` has its own $integrateFunctions() variant and the issue flagged it as worth
checking. It is not affected: it assigns unconditionally with no existence check and has no
`super<name>` concept at all, so there is no asymmetry to correct. Left alone.
Red-first, against the pristine Controller.cfc: the two controller specs fail —
`Expected [false] to be true` and `No matching function [SUPERLINKTO] found` — while the
model-side spec and the no-override spec pass. That split is the bug, stated as a test.
4 specs, using two new fixtures of the same name on each side: a controller overriding
`linkTo()` and a model overriding `columnNames()`, both delegating through `super<name>`.
The controller spec asserts a real anchor comes back and that the prefix appears exactly
once, so it proves the framework original ran rather than the override recursing. The model
spec pins behaviour that already worked, so the parity cannot regress from either direction.
The fourth asserts the zero-extra-keys property above.
Docs are NOT included here. The v3 guide presents the convention as general and the v4-0-0
tree has no "Overriding Core Methods" page at all; porting and correcting it is a separate
change against the guides site.
Verification, lucee7 + sqlite, full core suite:
develop ab901cf 4732 pass / 0 fail / 0 error
this branch 4736 pass / 0 fail / 0 error
Exactly +4, the new specs.
Closes #3325
Signed-off-by: Peter Amiri <peter@alurium.com>1 parent 1987187 commit 80773ab
5 files changed
Lines changed: 107 additions & 4 deletions
File tree
- changelog.d
- vendor/wheels
- tests
- _assets
- controllers
- models
- specs/controller
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
398 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
399 | 407 | | |
400 | 408 | | |
401 | 409 | | |
| |||
407 | 415 | | |
408 | 416 | | |
409 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
410 | 422 | | |
411 | 423 | | |
412 | 424 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
0 commit comments