Users Table
Email(username)
validation Rules in Users Model->
$validator
->requirePresence('username')
->add('username', 'validFormat', ['rule' => 'email', 'message' => 'Email id must be valid'])
->maxLength('username', 150)
->allowEmptyString('username', false, 'Please enter your email id');
validation Rules in Employee Model->
$validator->allowEmptyString('username');
email(Username) saved in User table when user in Employee add data.
when I save employee data i want skip the validation for usernames
i tried following code but it won’t works.
$employee = $this->Employees->patchEntity($employee, $this->request->getData(), [‘validate’ => false]);
any suggestion