Validation Support
Closed this issue · 1 comments
ivanwilliammd commented
Dear @dcarbone
I'm really interested whether php-fhir-generated have validation support from API request?
If there are, please kindly share some snippet / guide doing that?
Thanks.
ivanwilliammd commented
Have got it
// Function FHIR Template Logic
public function schemaValidation($fhirLoadedSchema)
{
$errors = $fhirLoadedSchema->_getValidationErrors();
return($errors);
}
the $fhirLoadedSchema that passed to function schema Validation would be looking like this
use DCarbone\PHPFHIRGenerated\R4\FHIRResource\FHIRDomainResource\FHIREncounter;
public function __construct(Request $request)
{
$this->setDefaultSuccessResponse([]);
$this->model = new Encounter;
$this->FHIREncounter = new FHIREncounter($request->except('id'));
}