| description | Validate that references point to resources conforming to required target profiles. |
|---|---|
| icon | link |
Validates that a Reference- or canonical-typed property points to a resource conforming to at
least one of the declared target profile URLs, via FHIRTargetProfileValidator, driven by the
#[FHIRTargetProfile] attribute (which carries a targetProfiles list).
{% hint style="info" %}
Reference resolution is pluggable through FHIRReferenceResolverInterface. Configure a resolver
on the Configuration page. The default NullFHIRReferenceResolver skips all
target-profile checks silently.
{% endhint %}
For each Reference object (and each element of an array of references), the validator delegates
resolution to the configured FHIRReferenceResolverInterface::resolve():
- If the resolver returns
null(including theNullFHIRReferenceResolverdefault), the check is skipped silently — no violation. - If the resolved object carries no
#[FHIRProfile]attribute, a WARNING is emitted:Cannot verify target profile conformance: the resolved object carries no #[FHIRProfile] attribute. - If the resolved object has profiles but none match any URL in
targetProfiles, an ERROR is emitted listing expected vs. actual profile URLs.
Canonical-typed values (raw string or \Stringable objects such as CanonicalPrimitive) are
always skipped — they cannot be resolved to an in-process PHP object. Null values are skipped.
Both messages are overridable via the FHIRTargetProfile key in FHIRValidationMessageRegistry.
See Configuration for wiring a Bundle-scanning or registry-based resolver
that maps Reference objects to their target PHP model.