/** * Validate customer address entity * * @param \Magento\Framework\Object $address * @return void * @throws \Magento\Framework\Validator\ValidatorException When validation failed */ protected function _validate($address) { $validator = $this->_validatorFactory->createValidator('customer_address', 'save'); if (!$validator->isValid($address)) { throw new \Magento\Framework\Validator\ValidatorException(InputException::DEFAULT_MESSAGE, [], null, $validator->getMessages()); } }
/** * Validate customer entity * * @param \Magento\Customer\Model\Customer $customer * @return void * @throws \Magento\Framework\Validator\ValidatorException When validation failed */ protected function _validate($customer) { $validator = $this->_validatorFactory->createValidator('customer', 'save'); if (!$validator->isValid($customer)) { throw new \Magento\Framework\Validator\ValidatorException($validator->getMessages()); } }