mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
mvc: Phalcon framework dependency (https://github.com/opnsense/core/issues/6389)
Fix regression in c2ea9aa303, performValidation() should return an object which is able to add new messages (using appendMessage()) as the previous Messages class did.
This commit is contained in:
parent
35b5e0b64b
commit
5fc54cf66b
@ -28,16 +28,15 @@
|
||||
|
||||
namespace OPNsense\Base;
|
||||
|
||||
class Validation
|
||||
class Validation extends \ArrayObject
|
||||
{
|
||||
private $validators = [];
|
||||
private $messages = null;
|
||||
private $data = [];
|
||||
|
||||
public function __construct($validators = [])
|
||||
{
|
||||
parent::__construct();
|
||||
$this->validators = $validators;
|
||||
$this->messages = [];
|
||||
$this->data = [];
|
||||
}
|
||||
|
||||
@ -47,7 +46,7 @@ class Validation
|
||||
*/
|
||||
public function appendMessage($message)
|
||||
{
|
||||
$this->messages[] = $message;
|
||||
$this[] = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,10 +89,10 @@ class Validation
|
||||
$phalconMsgs = $phalcon_validation->validate($data);
|
||||
if (!empty($phalconMsgs)) {
|
||||
foreach ($phalconMsgs as $phalconMsg) {
|
||||
$this->messages[] = $phalconMsg;
|
||||
$this[] = $phalconMsg;
|
||||
}
|
||||
}
|
||||
return $this->messages;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValue($attribute)
|
||||
@ -106,6 +105,6 @@ class Validation
|
||||
*/
|
||||
public function getMessages()
|
||||
{
|
||||
return $this->messages;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user