From 1991122c32eeaf991519dd892b6218f99e4e2efd Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Tue, 4 Jun 2024 13:34:31 +0000 Subject: [PATCH] - Filling values of context if vars exists within it --- src/Method/FormContext.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Method/FormContext.php b/src/Method/FormContext.php index 6f1ca19..9fb3f75 100644 --- a/src/Method/FormContext.php +++ b/src/Method/FormContext.php @@ -51,6 +51,8 @@ class FormContext implements FormContextInterface } } + $this->fillValues(); + $this->files = $request->getUploadedFiles() ?: []; } @@ -142,4 +144,13 @@ class FormContext implements FormContextInterface { $this->messages[] = $message; } + + protected function fillValues() : void + { + foreach($this->values as $property => $value) { + if (property_exists($this, $property)) { + $this->$property = $value; + } + } + } } \ No newline at end of file