feat(form-builder): add BindingTypeRegistry as single source of truth for target shapes (WS-6)
Config-driven mapping from (target_entity, target_attribute) to storage shape (scalar/collection/relation), PHP type, and identity-key eligibility. Replaces any name-suffix matching (e.g. _tags, _skills) — those are convention-not-contract and reject by design. Used by publish guards now and (in session 2) by FormBindingApplicator. Refs: RFC-WS-6.md §4 (V1) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Exceptions\FormBuilder;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* RFC-WS-6 §4 (V1) — thrown when a binding configuration is structurally
|
||||
* invalid for its target shape. Most common case: `merge_strategy=Append`
|
||||
* on a SCALAR target.
|
||||
*/
|
||||
final class InvalidBindingTargetException extends RuntimeException
|
||||
{
|
||||
public function __construct(
|
||||
public readonly string $entity,
|
||||
public readonly string $attribute,
|
||||
public readonly string $reason,
|
||||
) {
|
||||
parent::__construct(
|
||||
"Invalid binding target {$entity}.{$attribute}: {$reason}",
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user