When i try to validate two values with two model validators i get errors on both Its a rest API and values are send like JSON in body. Errors occurs with InclusionIn and Uniqueness validators. Version of the Phalcon is 3.0.1
use Phalcon\Mvc\Model;
use Phalcon\Mvc\Model\Validator\Uniqueness;
use Phalcon\Mvc\Model\Validator\InclusionIn;
class Objects extends Model
{
public function validation()
{
$this->validate(
new InclusionIn(
[
"field" => "type",
"domain" => ["one","two"]
]
)
);
$this->validate(
new Uniqueness(
[
"field" => "name",
"message" => "The object name must be unique",
]
)
);
if ($this->validationHasFailed() === true) {
return false;
}
}
}
and the InclusionIn error is
( ! ) Fatal error: Uncaught TypeError: Argument 1 passed to Phalcon\Mvc\Model::validate() must implement interface Phalcon\ValidationInterface, instance of Phalcon\Mvc\Model\Validator\Inclusionin given in C:\wamp64\www\twm\models\Robots.php on line 18
( ! ) TypeError: Argument 1 passed to Phalcon\Mvc\Model::validate() must implement interface Phalcon\ValidationInterface, instance of Phalcon\Mvc\Model\Validator\Inclusionin given in C:\wamp64\www\twm\models\Robots.php on line 18
the Uniqueness error is
( ! ) Fatal error: Uncaught TypeError: Argument 1 passed to Phalcon\Mvc\Model::validate() must implement interface Phalcon\ValidationInterface, instance of Phalcon\Mvc\Model\Validator\Uniqueness given in C:\wamp64\www\twm\models\Robots.php on line 28
( ! ) TypeError: Argument 1 passed to Phalcon\Mvc\Model::validate() must implement interface Phalcon\ValidationInterface, instance of Phalcon\Mvc\Model\Validator\Uniqueness given in C:\wamp64\www\twm\models\Robots.php on line 28