Problem

VisitTracker::trackVisit() builds its insert fields inline, making it impossible for submodules to add extra columns (e.g. domain_id) without duplicating the entire insert logic.

The ShortUrlVisitMiddleware already has a buildVisitFields() method that subclasses can override, but the VisitTracker service does not.

Proposed solution

Extract the field-building logic into a protected buildVisitFields(Redirect $redirect, Request $request) method, matching the pattern already used in the middleware. This allows submodules like domain_shorturl to extend VisitTracker and add extra columns transparently with a single INSERT query.

Issue fork shorturl-3584473

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Issue summary: View changes

mably’s picture

Status: Active » Needs review

  • mably committed 1411957b on 2.x
    task: #3584473 Extract buildVisitFields() method in VisitTracker for...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.