- Fixed a bug when an enum is given as value
This commit is contained in:
parent
94903d6f05
commit
363da77669
@ -176,7 +176,12 @@ class FormContext implements FormContextInterface
|
|||||||
|
|
||||||
public function pushMessage(FormMessage $message) : void
|
public function pushMessage(FormMessage $message) : void
|
||||||
{
|
{
|
||||||
$this->formContextMessages[] = $message;
|
if ($message->isError() /* && $message->isSuccess() @TODO next major v. */ ) {
|
||||||
|
$this->formContextMessages = array_merge([ $message ], $this->formContextMessages);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->formContextMessages[] = $message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function messages() : array
|
public function messages() : array
|
||||||
@ -184,10 +189,8 @@ class FormContext implements FormContextInterface
|
|||||||
return $this->formContextMessages;
|
return $this->formContextMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function fillValues() : void
|
protected function fillValues() : void
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach($this->formContextValues as $property => $value) {
|
foreach($this->formContextValues as $property => $value) {
|
||||||
if ($this->canWriteProperty($property)) {
|
if ($this->canWriteProperty($property)) {
|
||||||
$this->$property = $this->castValue($property, $value);
|
$this->$property = $this->castValue($property, $value);
|
||||||
|
|||||||
@ -12,4 +12,6 @@ interface FormContextInterface {
|
|||||||
public function requestMethod() : string;
|
public function requestMethod() : string;
|
||||||
|
|
||||||
public function getRequest() : ServerRequestInterface;
|
public function getRequest() : ServerRequestInterface;
|
||||||
|
|
||||||
|
public function getExecutionStatus() : mixed;
|
||||||
}
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Picea\Ui\Method;
|
namespace Picea\Ui\Method;
|
||||||
|
|
||||||
interface FormMessage {
|
interface FormMessage {
|
||||||
public function isError() : bool;
|
public function isError() : bool;
|
||||||
|
# public function isSuccess() : bool; # Should be added in next major version
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user