Example #1
0
 /**
  * Do validation of customer and its address using validate methods in models
  *
  * @param Mage_Customer_Model_Customer $customer
  * @param Mage_Customer_Model_Address|null $address
  * @throws Magento_Validator_Exception
  */
 protected function _validateCustomer($customer, $address = null)
 {
     $errors = array();
     if ($address) {
         $addressErrors = $address->validate();
         if (is_array($addressErrors)) {
             $errors = array_merge($errors, $addressErrors);
         }
     }
     $customerErrors = $customer->validate();
     if (is_array($customerErrors)) {
         $errors = array_merge($errors, $customerErrors);
     }
     if (count($errors) > 0) {
         throw new Magento_Validator_Exception(array($errors));
     }
 }
Example #2
0
 /**
  * Do address validation using validate methods in models
  *
  * @param Mage_Customer_Model_Address $address
  * @throws Magento_Validator_Exception
  */
 protected function _validateAddress($address)
 {
     $addressErrors = $address->validate();
     if (is_array($addressErrors) && count($addressErrors) > 0) {
         throw new Magento_Validator_Exception(array($addressErrors));
     }
 }