I have a trait using the new style of validation:
namespace Common\Models\Traits;
use Phalcon\Validation\Validator\InclusionIn;
trait MySoftDeletable {
public function beforeValidation() {
$validator = new \Phalcon\Validation();
$validator->add(
"status",
new Inclusionin([
"domain" => ["A", "D", "L"]
])
);
return $this->validate($validator);
}
public function beforeDelete() {
$validator = new \Phalcon\Validation();
$validator->add(
"status",
new Inclusionin([
"domain" => ["A", "D", "L"]
])
);
return $this->validate($validator);
}
}
But I am getting this error when using the trait in my Collection?
Catchable fatal error: Argument 1 passed to Phalcon\Mvc\Collection::validate() must implement interface Phalcon\Mvc\Model\ValidatorInterface, instance of Phalcon\Validation given
Firstly what is a Collection demanding a Model validator when they are in seperate domains.
Secondly why aren't Collections using the new way of validating that can allow to be used across Models and Collections?
Sanity check please.