- Worked with the files begin on the context part

This commit is contained in:
mcndave committed 2021-03-09 15:27:54 +00:00
1 parent e75d997b02
commit 0d9db0470e
3 files changed
+14 -1

No files matched your search

+11
View File
@@ -11,8 +11,12 @@ class FormContext implements FormContextInterface
public bool $formSent;
public bool $formExecuted = false;
public array $values = [];
public array $files = [];
public array $messages = [];
public ServerRequestInterface $request;
@@ -28,6 +32,8 @@ class FormContext implements FormContextInterface
}
$this->values = $request->getParsedBody() ?: [];
$this->files = $request->getUploadedFiles() ?: [];
}
public function valid() : bool
@@ -41,6 +47,11 @@ class FormContext implements FormContextInterface
return true;
}
public function executed() : bool
{
return $this->formExecuted;
}
public function formSent() : bool
{
return $this->formSent;
+2
View File
@@ -50,6 +50,8 @@ class FormHandler {
if ( $this->sent ) {
if ( $this->form->validate($this->context) ) {
$this->executionStatus = $this->form->execute($this->context);
$this->context->formExecuted = true;
}
}
}
+1 -1
View File
@@ -8,5 +8,5 @@ interface FormInterface
public function validate(FormContextInterface $context) : bool;
public function execute(FormContextInterface $context) : void;
public function execute(FormContextInterface $context) /* : mixed */;
}