Skip to content

docs(web/guides): fix mailer pattern in sending-email guide to use Global.cfc factory - #3098

Closed
wheels-bot[bot] wants to merge 1 commit into
developfrom
docs/bot-3078-sending-email-guide-s-mailer-pattern-new-wheels-co
Closed

docs(web/guides): fix mailer pattern in sending-email guide to use Global.cfc factory#3098
wheels-bot[bot] wants to merge 1 commit into
developfrom
docs/bot-3078-sending-email-guide-s-mailer-pattern-new-wheels-co

Conversation

@wheels-bot

@wheels-bot wheels-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

The "Organize sends in app/mailers/" section of sending-email.mdx showed new wheels.Controller().sendEmail() as the mailer pattern. A bare new wheels.Controller() skips the framework's initialization path and leaves the instance without variables.params, which sendEmail()$renderView() references in its default argument expressions — throwing on every supported engine (Component [wheels.Controller] has no accessible Member with name [PARAMS] on Lucee 7; Element PARAMS is undefined on Adobe 2023). This PR replaces both UserMailer methods with new wheels.Global().controller(name=..., params={...}).sendEmail(), the supported factory that fully wires up the instance, and adds an <Aside> warning so the correct vs incorrect pattern is explicit.

Fixes #3078

Screenshots needed

None — this is a prose and code-sample change only.

…obal.cfc factory

Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>

@wheels-bot wheels-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wheels Bot — Reviewer

TL;DR: This PR fixes the sending-email guide's broken mailer pattern — replacing new wheels.Controller().sendEmail() (which throws on every engine because a bare instance has no variables.params) with the supported new wheels.Global().controller(name, params) factory — and adds an explanatory <Aside>. I verified every technical claim against the framework source and found no blocking issues. Verdict: approve (submitted as a comment review because the PR author and this reviewer are the same bot account, and GitHub rejects self-approval).

Verified claims (evidence)

  • Root cause is real. vendor/wheels/controller/rendering.cfc:575 declares string $controllerName = variables.params.controller as a default argument expression in $generateIncludeTemplatePath(), which sendEmail() reaches via $renderView() even with an absolute template= path. A bare new wheels.Controller() never populates variables.params, so the old sample throws exactly as described in #3078.
  • The replacement pattern is the supported factory. vendor/wheels/Global.cfc:1209public any function controller(required string name, struct params = {}) — and when params is non-empty it returns $createControllerObject(arguments.params), a fully initialized instance (Global.cfc:1226-1228, Controller.cfc:13-25).
  • name="UserMailer" is safe without a controller file. $objectFileName() falls back to the base Controller class when app/controllers/UserMailer.cfc doesn't exist (vendor/wheels/Global.cfc:1076-1077 — "by default we return Model or Controller so that the base component gets loaded"), so the sample won't throw a missing-component error.
  • <Aside> renders. The MDX file already imports it (line 9: import { Aside, CardGrid, LinkCard } from '@astrojs/starlight/components';), and the new note matches the four existing <Aside> usages in the file.

Docs

  • Changelog fragment present and correctly shaped: changelog.d/3078-sending-email-guide-mailer-factory.fixed.md (.fixed.md type, complete bullet line) — no direct CHANGELOG.md edit. ✓

Commits

  • Single commit docs(web/guides): fix mailer pattern in sending-email guide to use Global.cfc factory — valid type, subject under 100 chars, DCO sign-off present. ✓

Non-blocking note

  • "Fixes #3078" will close the issue, whose title also floats the alternative of hardening $renderView for out-of-request senders. The issue's own wording is "fix docs and/or harden", so a docs-only resolution is in scope — but if a maintainer wants the framework-side hardening too, it should be spun off into a follow-up issue before this merges and auto-closes #3078.

No correctness, cross-engine, security, convention, or commitlint findings. Clean docs fix, accurately evidenced.

@github-actions github-actions Bot added the docs label Jun 12, 2026
@bpamiri

bpamiri commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #3093 (merged 33ef66e, docs wave 2) — this draft branched before #3093 landed and edits the exact lines already rewritten there; develop additionally carries the richer caution Aside. No unique content to salvage.

@bpamiri bpamiri closed this Jun 12, 2026
@bpamiri
bpamiri deleted the docs/bot-3078-sending-email-guide-s-mailer-pattern-new-wheels-co branch June 12, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant