refactor(form-builder): consolidate subject-type allow-list into purpose registry
Q6 of ARCH-CONSOLIDATION-ADDENDUM-2026-04-24: the allowed `form_submissions.subject_type` values are now derived from `PurposeRegistry::allSubjectTypes()` instead of the parallel `config/form_subjects.php` file. - CreateFormSubmissionRequest validates `subject_type` against the registry via constructor-injected PurposeRegistry. - FormSubmissionController and FormValueService resolve the subject FQCN through `Relation::getMorphedModel()` — the morph-map is the single source of truth for alias → model mapping. - `config/form_subjects.php` is deleted. `MorphMapAlignmentTest` keeps the registry and morph-map aligned going forward. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -340,9 +340,8 @@ final class FormValueService
|
||||
}
|
||||
|
||||
if ($subjectType === $entity) {
|
||||
$map = config('form_subjects');
|
||||
$model = $map[$entity]['model'] ?? null;
|
||||
if ($model === null) {
|
||||
$model = \Illuminate\Database\Eloquent\Relations\Relation::getMorphedModel($entity);
|
||||
if ($model === null || ! class_exists($model)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user