Unable to use new style validations in Collections which is expecting validators from Model ???!!!!!

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.

Collection class is still using old validation. This is why Phalcon\Mvc\Model\Validator namespace wasn't removed in 3.0.0.



25.8k

This phased releasing solution is causing me heartache.

Do you know when they plan to move over to Phalcon\Validator in Collections?

I guess in 4.0.0 because of semver.



25.8k

next major release.

ok thanks.

Perhaps earlier, it's possible to make it BC.



25.8k

that would be \m/