docs(timetable): close ART-OBSERVER-ADVANCE-AGGREGATE; wire event_id through createDraft
§17.3 footnote already accurately describes ArtistResolver::fromPortalToken (checked at commitcc48011). Wired event_id end-to-end on the cleaner path: FormSubmissionService::createDraft now accepts event_id via the \$context bag, and the EngagementPortalController passes it from \$resolved->eventId. Replaces the prior post-save fallback. Per WS-4 denormalisation requirement. ART-OBSERVER-ADVANCE-AGGREGATE moved from open to closed — landed in Session 3 as the AdvanceSectionObserver (commit1716e09). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -254,23 +254,17 @@ final class EngagementPortalController extends Controller
|
||||
return $existing;
|
||||
}
|
||||
|
||||
// Pre-set event_id so the FormSubmissionObserver doesn't fall back
|
||||
// to the route('event') lookup (this portal route has no {event}
|
||||
// parameter — the engagement is the source of truth per WS-4).
|
||||
$submission = $this->submissionService->createDraft(
|
||||
// Pass event_id via the context bag — the schema is org-owned (not
|
||||
// event-owned) and this route has no {event} parameter for the
|
||||
// FormSubmissionObserver fallback. ARCH-FORM-BUILDER §17.3 footnote.
|
||||
return $this->submissionService->createDraft(
|
||||
schema: $schema,
|
||||
subject: $resolved->subject,
|
||||
submitter: null,
|
||||
context: [
|
||||
'idempotency_key' => 'artist_advance:'.$resolved->engagement->id,
|
||||
'event_id' => $resolved->eventId,
|
||||
],
|
||||
);
|
||||
|
||||
if ($submission->event_id === null) {
|
||||
$submission->event_id = $resolved->eventId;
|
||||
$submission->save();
|
||||
}
|
||||
|
||||
return $submission->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,13 @@ final class FormSubmissionService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $context opened_at / public_submitter_* / is_test / idempotency_key
|
||||
* @param array<string, mixed> $context opened_at / public_submitter_* / is_test / idempotency_key / event_id
|
||||
*
|
||||
* `event_id` may be supplied for flows where the schema is org-owned (not
|
||||
* event-owned) and the route has no `{event}` parameter for the
|
||||
* FormSubmissionObserver fallback to pick up — e.g. the artist-advance
|
||||
* portal where the engagement is the source of truth per WS-4
|
||||
* (ARCH-FORM-BUILDER §17.3 footnote).
|
||||
*/
|
||||
public function createDraft(FormSchema $schema, ?Model $subject, ?User $submitter, array $context = []): FormSubmission
|
||||
{
|
||||
@@ -62,6 +68,9 @@ final class FormSubmissionService
|
||||
$submission->subject_type = $this->morphKeyFor($subject);
|
||||
$submission->subject_id = (string) $subject->getKey();
|
||||
}
|
||||
if (isset($context['event_id']) && is_string($context['event_id']) && $context['event_id'] !== '') {
|
||||
$submission->event_id = $context['event_id'];
|
||||
}
|
||||
$submission->submitted_by_user_id = $submitter?->id;
|
||||
$submission->status = FormSubmissionStatus::DRAFT->value;
|
||||
$submission->is_test = (bool) ($context['is_test'] ?? false);
|
||||
|
||||
Reference in New Issue
Block a user