How to set additional data in custom Validation?


#1

I have created custom Validation class and method for validate data on remote services.
This work fine, but in validation method I must create get requests with some query params based on user selections other fields in form.

example, I validate email field, and must in that validation process to use data from other fields “type”.

    // remoteservice?email=some@email.com&type=advance
    $validator
        ->provider('remoteservice', '\RemoteService\Model\Validation\RemoteValidation')
        ->add('email', 'check', [
            'rule' => 'check',
            'message' => __('The email is not valid'),
            'provider' => 'remoteservice'
        ]);

How to set two or more fields data to one validation method?

public static function check($email)
{
// how to access $type here?
}

#2

OK, my fail.

public static function check($emai, $context)
{
//now  use $context here
}