Validator Not functioning


So I have the following… I have a form field mobilePhone that I am trying to validate into an e164 compliant phone number. When I add a user or edit an existing user it never runs this code and tries to validate it. What gives? Any thoughts would be awesome! Ive been stumped for hours…

        ->add('mobilePhone', 'checkPhone',[
            'rule' => 'checkPhone',
            'provider' => 'table',
            'message' => 'Please enter a valid phone number in this format: +14345551212'

public function checkPhone($value, array $context){
    return (\Cake\Validation\Validation::custom($value, '/^\+?[1-9]\d{1,14}$/i'));


First check your field name for mobilePhone. Then try to debug $user if the entity holds in this variable or variable defined by you after doing patchEntity. Also you can check in entity that is it accessible or not!


Just tried your suggestions they worked! Thanks much for the help and direction!