- Worked with the files begin on the context part

This commit is contained in:
Dave M. 2021-03-09 15:27:54 +00:00
parent e75d997b02
commit 0d9db0470e
4 changed files with 21 additions and 8 deletions

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;

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;
}
}
}

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 */;
}