public function validateData($data)
    {
        $result = ValidationResult::create();
        foreach ($this->getComponents() as $component) {
            try {
                $component->validateData($this->order, $this->dependantData($component, $data));
            } catch (ValidationException $e) {
                //transfer messages into a single result
                foreach ($e->getResult()->getMessages() as $code => $message) {
                    if (is_numeric($code)) {
                        $code = null;
                    }
                    if ($this->namespaced) {
                        $code = $component->namespaceFieldName($code);
                    }
                    $result->addError($message['message'], $code);
                }
            }
        }

        $this->order->extend('onValidateDataOnCheckout', $result);

        if (!$result->isValid()) {
            throw new ValidationException($result);
        }

        return true;
    }
public function validateData($data)
    {
        $result = ValidationResult::create();
        foreach ($this->getComponents() as $component) {
            try {
                $component->validateData($this->order, $this->dependantData($component, $data));
            } catch (ValidationException $e) {
                //transfer messages into a single result
                foreach ($e->getResult()->getMessages() as $code => $message) {
                    if (is_numeric($code)) {
                        $code = null;
                    }
                    if ($this->namespaced) {
                        $code = $component->namespaceFieldName($code);
                    }
                    $result->addError($message['message'], $code);
                }
            }
        }

        $this->order->extend('onValidateDataOnCheckout', $result);

        if (!$result->isValid()) {
            throw new ValidationException($result);
        }

        return true;
    }
public function validateData ( $ data ) { $ result = ValidationResult :: create ( ) ; foreach ( $ this -> getComponents ( ) as $ component ) { try { $ component -> validateData ( $ this -> order , $ this -> dependantData ( $ component , $ data ) ) ; } catch ( ValidationException $ e ) { //transfer messages into a single result foreach ( $ e -> getResult ( ) -> getMessages ( ) as $ code => $ message ) { if ( is_numeric ( $ code ) ) { $ code = null ; } if ( $ this -> namespaced ) { $ code = $ component -> namespaceFieldName ( $ code ) ; } $ result -> addError ( $ message [ 'message' ] , $ code ) ; } } } $ this -> order -> extend ( 'onValidateDataOnCheckout' , $ result ) ; if ( ! $ result -> isValid ( ) ) { throw new ValidationException ( $ result ) ; } return true ; }
Validate every component against given data.

@param array $data data to validate

@return boolean validation result
@throws ValidationException
Validate every component against given data .