コード例 #1
0
ファイル: Address.php プロジェクト: whoople/magento2-testing
 /**
  * Validate customer address entity
  *
  * @param \Magento\Framework\DataObject $address
  * @return void
  * @throws \Magento\Framework\Validator\Exception When validation failed
  */
 protected function _validate($address)
 {
     $validator = $this->_validatorFactory->createValidator('customer_address', 'save');
     if (!$validator->isValid($address)) {
         throw new \Magento\Framework\Validator\Exception(null, null, $validator->getMessages());
     }
 }
コード例 #2
0
ファイル: Customer.php プロジェクト: shabbirvividads/magento2
 /**
  * Validate customer entity
  *
  * @param \Magento\Customer\Model\Customer $customer
  * @return void
  * @throws \Magento\Framework\Validator\Exception
  */
 protected function _validate($customer)
 {
     $validator = $this->_validatorFactory->createValidator('customer', 'save');
     if (!$validator->isValid($customer)) {
         throw new ValidatorException(null, null, $validator->getMessages());
     }
 }