feat(form-builder): ApplyBindings listener chain with two-transaction pattern (WS-6)
ApplyBindingsOnFormSubmit (sync) wraps the applicator in DB::transaction and writes apply_status post-commit. On exception: outer catch records FormSubmissionActionFailure in a separate transaction (survives inner rollback), marks apply_status=failed, swallows so siblings keep running (RFC Q3, Q4). When ApplyBindings provisions a Person on a previously no-subject submission, the listener also writes subject_type/subject_id back so TriggerPersonIdentityMatchOnFormSubmit (next sync listener) can find the freshly-provisioned subject. ApplyBindingsOnFormSectionSubmitted (queued, feature-flagged) ready for ARTIST_ADVANCE activation per RFC Q10. Listener chain on FormSubmissionSubmitted explicitly registered in AppServiceProvider::boot for deterministic ordering (RFC Q1): ApplyBindings → IdentityMatch → queued siblings. FormBindingApplicator dropped 'final readonly' to 'class' so listener tests can subclass it for throw-path coverage; constructor properties remain readonly individually. Refs: RFC-WS-6.md §3 (Q1, Q3, Q4, Q10) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,7 +50,10 @@ use App\Models\UserInvitation;
|
||||
use App\Models\UserOrganisationTag;
|
||||
use App\Models\UserProfile;
|
||||
use App\Models\VolunteerAvailability;
|
||||
use App\Events\FormBuilder\FormSubmissionSectionSubmitted;
|
||||
use App\Events\FormBuilder\FormSubmissionSubmitted;
|
||||
use App\Listeners\FormBuilder\ApplyBindingsOnFormSectionSubmitted;
|
||||
use App\Listeners\FormBuilder\ApplyBindingsOnFormSubmit;
|
||||
use App\Listeners\FormBuilder\SyncTagPickerSelectionsOnSubmit;
|
||||
use App\Listeners\FormBuilder\TriggerPersonIdentityMatchOnFormSubmit;
|
||||
use App\Observers\FormBuilder\FormFieldChildTablesCascadeObserver;
|
||||
@@ -129,18 +132,39 @@ class AppServiceProvider extends ServiceProvider
|
||||
FormField::observe(FormFieldChildTablesCascadeObserver::class);
|
||||
FormFieldLibrary::observe(FormFieldChildTablesCascadeObserver::class);
|
||||
|
||||
// ARCH §31.10 — FORM-02 TAG_PICKER sync listener.
|
||||
// RFC-WS-6 §3 (Q1) — sync chain on FormSubmissionSubmitted, in
|
||||
// this exact order:
|
||||
// 1. ApplyBindingsOnFormSubmit (sync)
|
||||
// 2. TriggerPersonIdentityMatchOnFormSubmit (sync)
|
||||
// Queued listeners on the same event (SyncTagPickerSelectionsOnSubmit,
|
||||
// future webhook dispatcher, mailables) run in parallel after the
|
||||
// sync chain via the queue. Their relative registration position
|
||||
// is irrelevant.
|
||||
|
||||
// RFC Q1 — applies bindings sync before identity match runs.
|
||||
\Illuminate\Support\Facades\Event::listen(
|
||||
FormSubmissionSubmitted::class,
|
||||
ApplyBindingsOnFormSubmit::class,
|
||||
);
|
||||
|
||||
// ARCH §31.10 — FORM-02 TAG_PICKER sync listener (queued).
|
||||
\Illuminate\Support\Facades\Event::listen(
|
||||
FormSubmissionSubmitted::class,
|
||||
SyncTagPickerSelectionsOnSubmit::class,
|
||||
);
|
||||
|
||||
// ARCH §31.1 — identity-match trigger on event_registration.
|
||||
// ARCH §31.1 — identity-match trigger on event_registration (sync).
|
||||
\Illuminate\Support\Facades\Event::listen(
|
||||
FormSubmissionSubmitted::class,
|
||||
TriggerPersonIdentityMatchOnFormSubmit::class,
|
||||
);
|
||||
|
||||
// RFC Q10 — section-level apply stub. Runtime gated by feature flag.
|
||||
\Illuminate\Support\Facades\Event::listen(
|
||||
FormSubmissionSectionSubmitted::class,
|
||||
ApplyBindingsOnFormSectionSubmitted::class,
|
||||
);
|
||||
|
||||
ResetPassword::createUrlUsing(function ($user, string $token) {
|
||||
return config('crewli.portal_url') . '/wachtwoord-resetten?token=' . $token . '&email=' . urlencode($user->email);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user